Jump to content

Smooth curve based on curvature threshold


bobbybob

Recommended Posts

Resample Sop- resample by Polygons Edge-Maximum Segments- Treat Polygons As Subdivision Curves
@bobbybob Sorry for the quick response earlier 
Maybe This Also Can by Useful ! Who Knows
:wub:

float maxedgelength = chf("maxedgelength");
int n = npoints(1);
// create a polygonal primitive, returns primitive number
int polygon = addprim(0,’poly’);
//run over the points of the spherical curve
for(int i=0; i<n; i++){
    vector currT = attrib(1,’point’,’P’,i);
    vector nextT = attrib(1,’point’,’P’,(i+1)%n);
    float edgelength = acos(dot(currT,nextT));
    vector B = normalize(cross(currT,nextT));
    int d = floor(edgelength/maxedgelength);
    if(d!=0) edgelength/=d;
    vector4 q = quaternion(edgelength, B);
    // add subdivision points
    vector T_tilde = currT;
    do{int point = addpoint(0,T_tilde);
    addvertex(0,polygon,point);
    T_tilde = qrotate(q,T_tilde);
    d--;}while(d>0);
    
    }

 

Smth.hiplc

Edited by Librarian
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...