![]() |
【转帖】odgecircarc2d tangen
odgecircarc2d tangent
odgecircarc2d tangent the samplepoints() of a tangent (odgeline2d) to odgecircarc2d is returned null. what is the data present in m_point1, m_point2 of a tangent (odgeline2d) ? can anybody explain... i have same problem hi, tangent of circle is odgeline2d object. odgeline2d is infinite line. it hasn't start and end. it has only point and direction. so if you ask getsamplepoints(int numsample, odgepoint2darray& pointarray), it return nothing due to odgeline hasn't bounds. toolkit has odgeline2dseg object - it has start and end point. it is segment representation, but odgeline2d is line representation. code: bool odgecircarc2d::tangent(const odgepoint2d& pnt, odgeline2d& line, const odgetol& tol) const { if(!odequal(pnt.distanceto(m_pcenter), radius(), tol.equalpoint())) return false; odgevector2d v = pnt - m_pcenter; v.rotateby(odapi2); // anyway, cw or ccw line.set(pnt, v); return true; } bool odgecircarc2d::tangent(const odgepoint2d& pnt, odgeline2d& line, const odgetol& tol, odgeerror& error) const { odgevector2d v = pnt - m_pcenter; double l = v.length(); if(odequal(l, radius(), tol.equalpoint())) { v.rotateby(odapi2); // anyway, cw or ccw line.set(pnt, v); error = odge::karg1onthis; return true; } error = ( l < radius() ) ? odge::karg1insidethis : odge::karg1toobig; return false; } |
所有的时间均为北京时间。 现在的时间是 03:28 PM. |