Hello in the following picture i need to find objects that have circle hole inside of it.I tried to use euler number but it allowed me to find all holes not only circles.
Related
I need to create a SKSpriteNode or a SKShapeNode such that it would look like the image below. I can figure out how to use a texture to get the shape of the line but I can't seem to find a way to make the physics body. It needs to be made out of two horizontal lines which can change their y position and the middle parabola-like shape joins the other two lines with a specified maximum point (the maximum would hopefully be a variable).
(Note:- the blue and green lines are just to highlight that the image is compromised of three objects)
Is this possible? Thanks!
i'm trying to do simple game in lazarus, but i'm stuck with one thing that i don't really want to overcomplicate. I have some circles on the screen (pretty small ones, 10pixels diameter) and i want to draw lines between two selected. So i thought i gonna make invisible hitboxes. I took care that two hitboxes doesn't intersect.
And i want to do simple drag and drop. If i drag circle or it's hitbox and drop it on another circle or it's hitbox i want to draw a line between those two circles. And my question is: is there a elegant way of knowing which circle belongs to a hitbox? Or maybe some other nice solution to this problem?
I'm not sure how exactly you have your setup, so the answer is quite generic.
You can start with the following:
Have a function to detect which circle is below cursor - CircleHitTest(X,Y: Integer): Integer;. If there's no circle at given XY - return -1.
Upon MouseDown detect which circle was under a cursor and store it's Id in variable DrawFrom.
Upon MouseUp detect which circle was under a cursor and store it's Id in variable DrawTo
If DrawFrom and DrawTo are two different and valid circles - draw a line between them.
How to draw an arc in createJS. I have gone through arcTo function but its not what i want. I want to be able to draw several arcs which when put together resembles a circle.
for Ex: I want to be able to draw a circle using 8 arcs. not able to do it using ArcTo function. Please some one suggest me a way to do it.
The arcTo function draws directly from the specified point. The arc() function is what you are looking for.
Here is a quick sample that draws random segments.
http://jsfiddle.net/lannymcnie/nJKHk/
shape.graphics.arc(0,0,50,startAngle,endAngle);
here is another sample with random color fills.
http://jsfiddle.net/lannymcnie/nJKHk/1/
My physics world needs a circular boundary. How can that be set? Primitive object does not include 'circle'. So can't specify the wall bound directly. Kindly guide.
There is no direct support as far as I have tried. But you can do repeated lines around the circumference of circle to generate a circular collision wall.
You can use the following link to generate points that can be used to draw lines. Formula to find points on the circumference of a circle, given the center of the circle and the radius
I am able to draw shapes using the UIBezierPath object. Now I want to identify different shapes drawn using this eg. Rectangle , Square , Triangle , Circle etc. Then next thing I want to do is that user should be able to select a particular shape and should be able to move the whole shape to different location on the screen. The actual requirement is even more complex , but If I could make this much then I can work out on the rest.
Any suggestion or links or points on how do I start with this is welcome . I am thinking of writing a separate view to handle every shape but not getting how do I do that..
Thank You all in advance !!
I recommend David Gelphman’s Programming with Quartz.
In his chapter “Drawing with Paths” he has a section on “Path Construction Primitives” which provides a crossroads:
If you use CGContextAddLineToPoint your user could make straight lines defined by known Cartesian points. You would use basic math to deduce the geometric shapes defined by those points.
If you use CGContextAddCurveToPoint your user could make curved lines defined by known points, and I’m pretty sure that those lines would run through the points, so you could still use basic math to determine at least an approximation of the types of shapes formed.
But if you use CGContextAddQuadCurveToPoint, the points define a framework outside of the drawn curve. You’d need more advanced math to determine the shapes formed by curves along tangents.
Gelphman also discusses “Path Utility Functions,” like getting a bounding box and checking whether a given point is inside the path.
As for moving the completed paths, I think you would use CGContextTranslateCTM.