circle

Silverlight 3 ArcSegment to always draw circle's

Hi everyone, Ok, my arcSegment must always draw Circle's. For this reason I calculate the Arc's Width with the following formula: arcXRadius = (4 * Math.Pow(height, 2) + Math.Pow(distanceArcPoints, 2)) / (8 * height); so Arcs.Size = (arcXRadius,height) But seems that the height is scaled down when drawn. I want to add a small Circle ...

Oval collision detection not working properly

So I'm trying to implement a test where a oval can connect with a circle, but it's not working. edist = (float) Math.sqrt( Math.pow((px + ((pwidth/2) )) - (bx + (bsize/2)), 2 ) + Math.pow(-((py + ((pwidth/2)) ) - (bx + (bsize/2))), 2 ) ); and here is the full code (requires Slick2D): import org.newdawn.slick.AppGameContainer...

Choosing circle radius to fully fill a rectangle

Hi, the pixman image library can draw radial color gradients between two circles. I'd like the radial gradient to fill a rectangular area defined by "width" and "height" completely. Now my question, how should I choose the radius of the outer circle? My current parameters are the following: A) inner circle (start of gradient) center p...

How to detect if an ellipse intersects(collides with) a circle

I want to improve a collision system. Right now I detect if 2 irregular objects collide if their bounding rectangles collide. I want to obtain the for rectangle the corresponding ellipse while for the other one to use a circle. I found a method to obtain the ellipse coordinates but I have a problem when I try to detect if it intersect...

Formula to determine if a line segment intersects a circle (flat)

Hi, Apologies if this is considered a repeat question, but the answers I've seen on here are too complex for my needs. I simply need to find out if a line segment intersects a circle. I don't need to find the distance to the line from the circle center, I don't need to solve for the points of intersection. The reason I need something...

How to draw circle with specific color in XNA?

XNA doesn't have any methods which support circle drawing. Normally when I had to draw circle, always with the same color, I just made image with that circle and then I could display it as a sprite. But now the color of the circle is specified during runtime, any ideas how to deal with that? ...

Get all Vector2 Points Within Radius

I am looking for a formula that will give me all of the Vector2 Points within a certain radius given the center. Essentially what I am trying to do is change the color of each pixel in a 256 x 256 texture that is within a certain radius from a specific pixel (Using the Unity3d Game Engine). Programming Language doesn't really matter, ...

How do I know when to increase or decrease angle to get a specific angle?

Hi. I am programming a game and I have come to a very hard spot. Basically I have a circle and I have 2 angles on this circle. Angle 1 (A) is a point I want angle 2 (B) to go to. During my game every frame I need to check weither or not to increase or decrease my angle value by a certain amount (speed) to eventually reach the first angle...

circular objects detection

please suggest me some algorithms for circular object detection, for example a CD is placed under the book, and some part of it can be seen. So the algorithm should be able to detect a circle from the part of the CD. Or it can be a plates placed one above another and so on. I tried opencv's Hough transform, but it do not always detects ...

Reflecting a circle off another circle

Working with iPhone and Objective C. I am working on a game and I need to correctly reflect a ball off a circle object. I am trying to do it as a line and circle intersection. I have my ball position outside the circle and I have the new ball position that would be inside the circle at the next draw update. I know the intersect point of...

Detecting a circle of a specific color (or gray level) with openCV

Hi, Is there a way to detect a circle with a specific grey level using openCV? I want to detect a circle that marks out from the others. Currently, I'm using cvHoughCircles to detect my circles. I know the method returns an array of cvSeq containing the info on each circle (point and radius), but it does not provide any color informati...

Algorithm to cover maximal number of points with one circle of given radius

Let's imagine we have a plane with some points on it. We also have a circle of given radius. I need an algorithm that determines such position of the circle that it covers maximal possible amount of points. If there are many such positions, the algorithm should return one of them. Precision is not important and algorithm may do small mi...

Define a circle / arc animation in SVG

Does anyone know how to define an animated arc / circle in SVG, such that the arc starts at 0 degrees and ends at 360 degrees? ...

Positioning squares on a circle with minimum diameter

Given n squares with edge length l, how can I determine the minimum radius r of the circle so that I can distribute all squares evenly along the perimeter of the circle without them overlapping? (Constraint: the first square will always be positioned at 12 o'clock.) Followup question: how can I place n identical rectangles with height h...

How to draw a circle and search within the circle on a Google Maps API?

On my web page I have already a Google Maps API with a search bar (see code below) and at first the user pinpoints an address. Then the User is be able to search businesses around this point with a search bar. Before search is complete I'd like to draw a circle around this address for instance with a distance of 15 km. The search should ...

Calculate arc length / central angle of circle using Gesture Recognizers

I need to rotate a circle by an amount equal to the distance travelled by the users finger... This would equate to the length of the arc moved by the finger... I know the radius of the circle, but need to calculate the central angle and maybe the arc length. Can i do this using any functions in PanGestureRecognizer? translationInView? ...

Calculate vertices of a circle

Hey guys, I am having a simple program, it draws a circle :/ This works fine... for (k = 1; k < n+1+1; k++){ vertices[k].color = GU_COLOR( 0.0f, 0.0f, 1.0f, 0.0f ); vertices[k].x = cos_d( 360 - ((k-1) * dstep) ); vertices[k].y = sin_d( 360 - ((k-1) * dstep) ); vertices[k].z = 0.0f; } ... //Now draw it sceGumDrawArray(GU_TRIANGLE_FAN...

Positioning circles

Hi, I'd like to position a given amount of circles in a field, whose size is also known. The circle's sizes can be freely choosen (although it should be >0). They may not overlap. The problem: Performance is critical. Just randomly positioning them and reposition them in case they overlap is not fast enough. My target is the iPhone, s...

Calculating points of a circle dynamically in an Android game

Hi there If my X co-ordinates increment every time a frame is drawn, what formula can I employ from the math library in order to have the Y co-ordinate moving around the circumference of a circle frame by frame, creating the illusion of an orbiting object around a continuously moving central point? I have seen it may involve sin or cos...

Generate a random vector inside a rectangle but not a circle?

I have a rectangle, and a circle inside that rectangle (that sits around the center of the rectangle). I want to generate a random 2-component vector that falls inside the rectangle, but not the circle. How can I do it? Edit: I'd prefer a method that i can use to generate a vector that meets these constraints without brute-forcing it. ...