![]() |
【转帖】deviation and relative deviation
deviation and relative deviation
deviation and relative deviation hi, i have a drawing with many circles of different diameters varying between 0.25 and 256. 1. with no deviation touching, all circles has some deviation, all circles has the same number of segments, which mean that _relative_ (to diameter) deviation is the same, but absolute deviation for big circles is bigger than for small circles. now, i want to make circles more accurate, i want each circle to have, lets say, four times more segments, but still all circles should have the same number of segments. is there any way to do it? 2. using setdeviation before rendering causes that _absolute_ deviation is set and used, not relative, so small circles looks like triangles and big circles are smooth. it's not what i wanted and it is worse than default (1) behaviour. tia regards, micha? ?liwka attached files hi, i understand, that there may be more question than people to answer it, but can you tell me please, are you working on this problem or just have not read the message yet? thanks in advace. regards, michal sliwka hi, there are two setdeviation in toolikt : void setdeviation(const odgedoublearray& deviations); void setdeviation(const odgideviation* pdeviation); setdeviation(const odgideviation* pdeviation) used in our vectorizer. odgideviation has method deviation(const odgideviationtype deviationtype, const odgepoint3d& pointoncurve). returned value depends on pointoncurve. did you mean setdeviation(odgedoublearray) or setdeviation(odgideviation) ? hi, i have used both methods with the same result. applied values did take effect (i have been modifying them) but they took effect in absolute, not relative manner described in my first post. regards, michal sliwka hi, how "returned value depends on pointoncurve" ? i don't see it in any example in 1.14 bundle. second issue is that in documentation pointoncurve is marked as output parameter but it's a _const_ reference. regards, micha? ?liwka code: void odgigeometrysimplifier::circleproc(const odgepoint3d& center, double radius, const odgevector3d& normal, const odgevector3d* pextrusion) { odgecircarc3d circarc(center, normal, radius); odgepoint3darray points; circarc.appendsamplepoints(0., oda2pi, deviation(kodgimaxdevforcircle, center), points); points.last() = points.first(); polylineproc(points.size(), points.getptr(), &normal, pextrusion); } input\output parameter : i think that this is mistake in our documentation. as i see all circles have the same center, so deviation() return the same value for all. next step is inside odgeelliparc3d::appendsamplepoints. it calculate small step angle based on radius and deviation. code: void odgeelliparc3d::appendsamplepoints(double fromparam, double toparam, double approxeps, odgepoint3darray& pointarray, odgedoublearray* pparamarray) const { double delta = toparam - fromparam; int n = getarcsegs(delta, approxeps, majorradius()); if (n) { delta /= n; } getarcsegs return different values for circles with different radius. you cannot change this functionality. last edited by sslezkin; 3rd august 2006 at 02:15 amfff">. alternative way is rewrite virtual void odgigeometrysimplifier::circleproc in inherited class. currently i do override circleproc and circulararcproc and put to appendsamplepoints "eps" dependent on _radius_ not center, because appendsamplepoints seems to not depend on radius in odgecircarc3d class. is appendsamplepoints radius - dependand only in odgeelliparc3d class? (through getarcsegs) it is depend. code: void odgecircarc3d::appendsamplepoints(double fromparam, double toparam, double approxeps, odgepoint3darray& pointarray, odgedoublearray* pparamarray) const { odgeelliparc3d elliparc(*this); elliparc.appendsamplepoints(fromparam, toparam, approxeps, pointarray, pparamarray); } also code: int getarcsegs(double angletointerpolate, double approxeps, double radius) { if (!odzero(radius, 0.)) { double maxstepangle = maxarcstepangle(approxeps / radius); return int(ceil(fabs(angletointerpolate) / maxstepangle)); } return 0; } and code: double maxarcstepangle(double n)// n = deviation / r { if (n <= 0.0) { return odapi / 16.; } if (n < 5.e-6) { return odapi / 500.; } double cosinhalfa = 1.0-n; if (cosinhalfa <= -1.0) { return odapi2; } return ::acos(cosinhalfa) * 2.0; } last edited by sslezkin; 3rd august 2006 at 03:24 amfff">. |
所有的时间均为北京时间。 现在的时间是 12:09 AM. |