You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am new to this great library.
Currently, I want to get sampling points evenly on the ICurveGeo.
I have tried to use pt(double u) function and got some points based on evenly sampling the u coordination. I just wonder if there is a way to let the user sampling points based on the arc-length of the curve, so the user can get those sampling points accurately.
Thanks a lot.
Again great library for 3D modeling in Java
The text was updated successfully, but these errors were encountered:
Thank you for the comment.
Unfortunately I don't have a method to sample NURBS curves evenly by the length in the XYZ space with mathematically accurate inverse calculation from XYZ to U.
What I would do is just approximate it by lengths of line segments like the code below.
You could replace the length calculation with arc-length calculation by 3 points or 2 points + tangent vectors to make it more accurate, or simply increase resolution of the line segment approximation depending on how much accuracy you need.
Thanks!
Satoru
int div = 10;
double len = 0;
// you could also use len() method, which is also linear approximation.
//double len = crv.len();
int res = 1000;
IVec prevPt = crv.pt(0);
for(int i=1; i<=res; i++){
IVec pt = crv.pt(i*1./res);
len += pt.dist(prevPt);
prevPt = pt;
}
Hi, I am new to this great library.
Currently, I want to get sampling points evenly on the ICurveGeo.
I have tried to use pt(double u) function and got some points based on evenly sampling the u coordination. I just wonder if there is a way to let the user sampling points based on the arc-length of the curve, so the user can get those sampling points accurately.
Thanks a lot.
Again great library for 3D modeling in Java
The text was updated successfully, but these errors were encountered: