Page 1 of 1

Drawing circle in 3D space

Posted: 06 Dec 2010, 13:56
by AmperNr1
Hello.

I have a problem with drawing circle (ellipse) in 3D space.
When I calculate x,y,z coordinates of the end point of the major axis of an ellipse (circle) then Z axis is ignored in view.

Fragment of my code looks as follow:

Code: Select all

MainConv = vGlobalCADFile->Converter;

   TsgDXFEllipse *Circle = new TsgDXFEllipse;

   double Radius = Hole->MHoleDiam/2.0;

   Circle->Color = clRed;
   Circle->Point = Point;

   Circle->Ratio = 1;
   Circle->Flags |= 0x11;


   TFPoint V1,V2,R;

   V1.X = Radius*cos(YRotation*M_PI/180.0);
   V1.Y = 0.0;
   V1.Z = Radius*sin(YRotation*M_PI/180.0);

   V2.X = 0.0;
   V2.Y = Radius*cos(XRotation*M_PI/180.0);
   V2.Z = Radius*sin(XRotation*M_PI/180.0);

   R.X = (V1.X + V2.X)/sqrt(2.0);
   R.Y = (V1.Y + V2.Y)/sqrt(2.0);
   R.Z = (V1.Z + V2.Z)/sqrt(2.0);

   Circle->RadPt = R;
   Circle->EndPoint = Circle->RadPt;
Thank you for any help.

Best regards,

Mariusz Hyżorek
Ema-Polska Sp. z o.o.

Re: Drawing circle in 3D space

Posted: 07 Dec 2010, 16:14
by support
Hello Mariusz,
DXF specification provides Extrusion property to specify 3D orientation of entities (circles, ellipses, texts, etc). Extrusion is a direction of Z axis of an entity. You need calculate coordinates of entity in XY plane and set extrusion.

Alexander.