cocoa: how to draw points? - cocoa

I want to draw the track of mouse when it down and move. I think I can do it by get all NSPoints and draw those points, but I don't know how to draw a point on screen. please help me! Or what other method I can do to implement it?

These are not the droids you're looking for.
err ..
I mean: it is not points you want to draw.
Draw lines, from a point to the next. (and then, of course, from the next to the second next and so forth).

Related

Cannot draw on the Oz dimension (Tried OSNAP)

I'm a beginner learning to draw with Autocad 2018. But drawing a house, I can't draw a door, a rectangle going up in Oz dimension. It's only allowed to draw in Oxy.
I tried turn on and off OSNAP (F3) but it did not work out.
Also I can't just draw a rectangle that starts from a line, it needs to be 2 lines.
Any help is appreciated. Thank you for your time.
I figured out:
You have to activate an option named "3d object snap". It's in the menu bar (bottom, farest to the right).

Collision detection alghorithm for moving objects

Please anybody give me an idea.
There are several (let's say ~20...) objects on screen that move and rotate about their center an each frame. When one object is rotates, his text hint rotates too. The problem is - if two hints come into collision, one of them must move at some angle so as not to collide with another hint.
Please tell me which algorithm should be applied here?
Here is picture to understand it - [ direct link: mlkt.jpg ].

LibGDX - The best way detect colission

I have an airplane. I use rectangle for bounding this airplane to detect collision and it works great. When the airplane begin falling down I rotate airplane's texture, but rectangle remains unchanged. I don't know how to rotate it. I need to rotate it with airplane's texture because my shell doesn't collide the airplane's tail and cabine.
How to rotate rectangle or perhaps create polygon shape to wrap all airplane? Any help will be appreciated!
#jellyfication's answer points to raycasting, but a different and also simple approach you could implement is the Separating Axis Theorem. The links below will show you in detail what the algorithm is about and how to implement it. They also have some interactive demos so you get the 'feel' for what the algorithm is doing.
http://www.metanetsoftware.com/technique/tutorialA.html
http://www.sevenson.com.au/actionscript/sat/
http://www.codezealot.org/archives/55 (this one has a lot of code)
http://gamedev.tutsplus.com/tutorials/implementation/collision-detection-with-the-separating-axis-theorem/
Good luck!
Use the polygon class to and draw your bounding Box.
Then within the polygon class there is a method to rotate.
Rotate and move the polygon with the plane.

Collision detection on diagonal lines in cocos2d

I'm working on a small iPhone/iPad game with the Cocos2d framework. Basically the idea of the game is very simple, there a ball which is moving at a certain speed. The user can draw a line so that the ball bounces in the opposite direction.
Now I've already have the ball moving and the user can draw a line also. (When he draw a line it becomes a member of an array and dissapears a few seconds later.)
But the question is how to detect a collision between the ball and a line? The line doesn't need to be horizontal or vertical, it can be diagonal also. It all depends on how the user draws this line.
I've the coordinates of the line: see the answer to my previous question: CGRect with an angle
Can you guys point in me right direction?
Thanks in advance!
You can use box2d to detect collisions. Actually, if your ball and these lines will have bodies in b2World, you will be able not to check collisions by yourself. All changes, bounces, etc. physics will done for you. You will only have to synchronize object's view position (also you can synchronize angle) according to the position of it's body in physical world.
You can use the Pixel perfect collision so when ball and line collide it is not check the rect but it check the pixel collision...
in this forum you got that you want..
http://www.cocos2d-iphone.org/forum/topic/18522/page/3

SIMPLE Ruby library for drawing shapes and managing clicks

I am looking for simple library for Ruby that could help me drawing things on the screen. I am not developing a game, I just want to display some graphs, so I need to
draw circles on a certain position,
put a label on these circles,
being notified that circle XYZ has been selected (I want to know the circle, not the coords),
draw lines connecting circles' borders,
change the color of the these circles,
(optional) animate moving a circle from position (x1,y1) to (x2,y2) in X seconds,
(even more optional) zoom on part of this scene.
Do you know anything that could help me with this?
Check out the green_shoes gem. Here's an example of some code to get you started, too!

Resources