Hello.
The simple code below always return 0.5 for Radius. It should be something 1258.2679. If chek for StartAngle it is 0 and End Angle is PI.
The same problem is in the AcGeCircArc2d;
AcGePoint3d p1(0,0,0);
AcGePoint3d p2(-0.0014937333762645721,0.0024172724350250974,0);
AcGePoint3d p3(-0.0029874704778194427,0.0048345386912274080,0);
AcGeError er;
AcGeCircArc3d circ3d;
circ3d.set(p1,p2,p3,er);
dRadius = circ3d.radius();
I can draw arc by this coordinates in acad, but i need AcGeCircArc3d or AcGeCircArc2d. Is it bug or is I missing something?
PS. I understand this arc can be the line, becouse it is so short, but it must be arc...
Igor
Solved! Go to Solution.
Solved by Anodl. Go to Solution.
Please provide some context. How are you testing, and under what conditions? AutoCAD version? OS architecture? What is the returned value of er?
Win 7 Professional x64, tested on Autocad 2011 x64 and 2014 x64 (I think acad version does not matter, x86 or x64 may be).
er is always ok. Testing in debugger of VS2008 or VS2010, also tried to look at results by acutPrintf() when building arx in Release mode, always the same wrong values.
Thank for trying help me.
Igor,
from the ObjectArx help:
AcGeCircArc3d(const AcGePoint3d& startPoint, const AcGePoint3d& pnt, const AcGePoint3d& endPoint);
Constructs an arc through three points.
None of the three points may be coincindent and they may not be colinear.
[...]
AcGeCircArc3d::set(const AcGePoint3d& startPoint, const AcGePoint3d& pnt, const AcGePoint3d& endPoint, AcGeError& er);
Changes the definition of the arc to have the specified start and endpoints and pass through pnt. None of the three points may be coincindent and they may not be colinear.
As I said this is very short arc it is almost line, but not. Simple checking by the code:
AcGePoint3d p1(0,0,0);
AcGePoint3d p2(-0.0014937333762645721,0.0024172724350250974,0);
AcGePoint3d p3(-0.0029874704778194427,0.0048345386912274080,0);
double g_Pi = 3.141592653589793;
double tang = (p2.y-p1.y)/(p2.x-p1.x);
double tang2 = (p3.y-p2.y)/(p3.x-p2.x);
double ang = atan(tang)*(180/g_Pi);
double ang2 = atan(tang2)*(180/g_Pi);
and the values are
ang -58.286353059128174 double
ang2 -58.286223667668850 double
tang -1.6182757066525819 double
tang2 -1.6182675342843891 double
so as you can see they are different. So this is the presicion/tolerance problem, but how can it can be handled to in AcGeCircArc3d or AcGeCircArc2d...
Hi Igor,
try to set the values "equalPoint" and "equalVector" of the global AcGeContext::gTol object to values like 1e-12 (or so) before you construct the circle:
AcGeContext::gTol.setEqualPoint(1e-12);
AcGeContext::gTol.setEqualVector(1e-12);
(and don't forget to set it back to the old values)
Arnold