Is this a bug of CircularArc3d class?

Is this a bug of CircularArc3d class?

Anonymous
Not applicable
719 Views
1 Reply
Message 1 of 2

Is this a bug of CircularArc3d class?

Anonymous
Not applicable
I want to get an arc passing through three given points.I use the CircularArc3d class to get the center,radius,startAngle and endAngle of the arc.But the arc does not pass through the three points.
static public void test() // This method can have any name
{
// Put your command code here
Point3d pt1=new Point3d(0,0,0);
Point3d pt2=new Point3d(10,10,0);
Point3d pt3=new Point3d(10,20,0);
CircularArc3d cirArc=new circularArc3d(pt1,pt2,pt3);
Arc arc=new Arc(cirArc.Center,cirArc.Radius,cirArc.StartAngle,cirArc.EndAngle);
Database db=Application.DocumentManager.MdiActiveDocument.Database;
DBTransMan tm=db.TransactionManager;
using(Transaction trans=tm.StartTransaction())
{
BlockTable bt=(BlockTable)tm.GetObject(db.BlockTableId,OpenMode.ForRead);
BlockTableRecord btr=(BlockTableRecord)tm.GetObject(bt[BlockTableRecord.ModelSpace],OpenMode.ForWrite);
btr.AppendEntity(arc);
tm.AddNewlyCreatedDBObject(arc,true);
trans.Commit();
}
}
0 Likes
720 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
No, I don't think this is a bug. This should do it:

Arc convertArc2Arc( CircularArc3d arc )

{

Vector3d refVec = arc.ReferenceVector;

Plane plane = new Plane(arc.Center, arc.Normal);

double ang = refVec.AngleOnPlane(plane);

return new Arc(arc.Center, arc.Normal, arc.Radius,arc.StartAngle + ang,
arc.EndAngle + ang );

}

Albert

wrote in message news:[email protected]...
I want to get an arc passing through three given points.I use the
CircularArc3d class to get the center,radius,startAngle and endAngle of the
arc.But the arc does not pass through the three points.
static public void test() // This method can have any name
{
// Put your command code here
Point3d pt1=new Point3d(0,0,0);
Point3d pt2=new Point3d(10,10,0);
Point3d pt3=new Point3d(10,20,0);
CircularArc3d cirArc=new circularArc3d(pt1,pt2,pt3);
Arc arc=new
Arc(cirArc.Center,cirArc.Radius,cirArc.StartAngle,cirArc.EndAngle);
Database db=Application.DocumentManager.MdiActiveDocument.Database;
DBTransMan tm=db.TransactionManager;
using(Transaction trans=tm.StartTransaction())
{
BlockTable bt=(BlockTable)tm.GetObject(db.BlockTableId,OpenMode.ForRead);
BlockTableRecord
btr=(BlockTableRecord)tm.GetObject(bt[BlockTableRecord.ModelSpace],OpenMode.ForWrite);
btr.AppendEntity(arc);
tm.AddNewlyCreatedDBObject(arc,true);
trans.Commit();
}
}