Page 1 of 1

How to draw a circle

Posted: 27 Nov 2014, 16:15
by Vito
Hi,

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

Thanks

Re: How to draw a circle

Posted: 27 Nov 2014, 19:00
by Eric
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