Skip to content

Conversation

@renato-grottesi
Copy link

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.

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.
@jcoffland
Copy link
Member

This is looking good. DXFModule::define should also have this code:

  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);
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 */
Copy link
Member

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 passctrlPt.wto theaddControlPoint()callback. The weights could then be added tostd::vector DXF::Spline::weightsand then later passed viaDXFModule`` to TPL.

}
var steps = Math.ceil(nurbs_length(s) / res);
//var delta = 1.0 / steps;
var delta = 0.01;
Copy link
Member

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?

Copy link
Author

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.


for (var i = 1; i <= 100; i++) {
var u = cubic_bezier(p, 0.01 * i);
var u = nurbs_interpolate(0.0*i, spl);
Copy link
Member

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.

@renato-grottesi renato-grottesi requested a review from jcoffland May 29, 2022 10:14
@jcoffland jcoffland mentioned this pull request Jun 16, 2022
@jcoffland jcoffland force-pushed the master branch 2 times, most recently from cf9d046 to e2af4b4 Compare November 19, 2022 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants