How to draw a circle

Typically: "How do I... ", "How can I... " questions
Post Reply
Vito
Posts: 17
Joined: 23 Sep 2014, 12:11

How to draw a circle

Post by Vito » 27 Nov 2014, 16:15

Hi,

I would like to draw a circle with something like simAddDrawingObject.
Is there any possibility to do that?

Thanks

Eric
Posts: 186
Joined: 11 Feb 2013, 16:39

Re: How to draw a circle

Post by Eric » 27 Nov 2014, 19:00

Hi

You could do that:

Code: Select all

	posC={0,0,0.1}
	r=0.5
	pt={}
	pt[3]=posC[3]
	ptsize=0.005

	local h=simAddDrawingObject(sim_drawing_spherepoints,ptsize,ptsize,-1,99999999,{0.1,0.9,0.1})

	for i=0,360,ptsize*10 do
		pt[1]=posC[1]+r*math.cos(i*math.pi/180)
		pt[2]=posC[2]+r*math.sin(i*math.pi/180)
		simAddDrawingObjectItem(h,pt)
	end
The code needs to be modified in order to draw circles not only horizontally, but that gives you an idea.

Cheers

Eric

Post Reply