高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】invalid input error with a circular arc
invalid input error with a circular arc
invalid input error with a circular arc
hi,
in one of our dwg files, we have a problem while trying to get a oddbarc's coordinates. all geometries in that file are read correctly, but one:
here are the properties of that arc:
startparam = 4.1663234055087264
endparam = 4.1664700616472619
p1 = (296705.09660002124, 5050519.7547099842, 0)
p3 = (296705.09738335985, 5050519.7542340243, 0)
p2 = (296705.09699168178, 5050519.7544719893, 0)
here is the source code which is used to get these values:
code:
odgepoint3d p1;
dbarc->getstartpoint(p1);
odgepoint3d p3;
dbarc->getendpoint(p3);
if ((fabs(p1.x - p3.x) > 1.e-6 || fabs(p1.y - p3.y) > 1.e-6))
{
double start, end;
dbarc->getstartparam(start);
dbarc->getendparam (end);
odgepoint3darray gepoints;
if (fabs(end - start) > 1.e-6)
{
odgepoint3d p2;
dbarc->getpointatparam((start + end) / 2, p2);
odgecircarc3d arc(p1, p2, p3);
arc.getsamplepoints (0, 0, 0, gepoints, null);
...the error is thrown a the odgecircarc3d's instanciation.
do you see any problem is my source code ? what is the validation that is made in the odgecircarc3d constructor ?
thank you very much for your help.
sylvain
you may use set() method of the odgecircarc3d, that accepts odgeerror& as a last parameter, to get more information about the error in that case.
vladimir
hi wvk,
thank you for your answer.
the error code which is returned is 8 => klinearlydependentarg1arg2arg3.
can you explain what is the meaning of that error code, so i'll add a validation for that kind of arcs ?
thank you again,
sylvain
the code means that 3 points are on the same line.
sergey slezkin
thank you for your answer serge?
the three coordinates that are used to create my circular arc are:
p1 = (296705.09660002124, 5050519.7547099842, 0)
p2 = (296705.09699168178, 5050519.7544719893, 0)
p3 = (296705.09738335985, 5050519.7542340243, 0)
in my example, since i know that these coordinates were projected from lon/lat to mtm8 and that the mtm projection uses the meter unit, there is less that one centimeter between those coordinates. so in this example, the behavior of the odgecircarc3d's constructor seems to be ok.
what would happen if coordinates were in lon/lat (wgs84) ? in that case, coordinates may have less that 1.0e-3 difference, and it would be normal. what are the validation and precision required in the odgecircarc3d constructor ?
thank you,
sylvain
default tolerance used in ge functions is 1.e-10
sergey slezkin
|