-
-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing long splines rendering #367
base: master
Are you sure you want to change the base?
Fixing long splines rendering #367
Conversation
The change allows correct rendering of quadratic and cubic splines with more than 4 control points by splitting the spline into segments and evaluating each segment as a quadratic or cubic spline, one at a time.
This is looking good. exports.insert("SPLINE_CLOSED", 1 << 0);
exports.insert("SPLINE_PERIODIC", 1 << 1);
exports.insert("SPLINE_RATIONAL", 1 << 2);
exports.insert("SPLINE_PLANAR", 1 << 3);
exports.insert("SPLINE_LINEAR", 1 << 4); |
tpl_lib/dxf/dxf.tpl
Outdated
var degree = spl.degree; | ||
var points = spl.ctrlPts; | ||
var knots = spl.knots; | ||
var weights = []; /* spl.weights; */ for(i=0; i<points.length; i++) { weights.push(1.0); } /* TODO */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The weights are in the DL_ControlPointData
structure. The function Reader::addControlPoint()should pass
ctrlPt.wto the
addControlPoint()callback. The weights could then be added to
std::vector DXF::Spline::weightsand then later passed via
DXFModule`` to TPL.
tpl_lib/dxf/dxf.tpl
Outdated
} | ||
var steps = Math.ceil(nurbs_length(s) / res); | ||
//var delta = 1.0 / steps; | ||
var delta = 0.01; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the value from nurbs_length()
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because of the bug you found at line 238 :-D
sorry for pushing in a rush, but that was it for my 30 minutes of coding.
I have one free hour now, I'll address all comments and try to implement closed curves at least.
tpl_lib/dxf/dxf.tpl
Outdated
|
||
for (var i = 1; i <= 100; i++) { | ||
var u = cubic_bezier(p, 0.01 * i); | ||
var u = nurbs_interpolate(0.0*i, spl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i*0.0
is always 0
.
Implemented and tested
cf9d046
to
e2af4b4
Compare
The change allows correct rendering of quadratic and cubic splines
with more than 4 control points by splitting the spline into
segments and evaluating each segment as a quadratic or cubic
spline, one at a time.