Jump to content

arcLength


Recommended Posts

Hi. I want to know the arc length of the curve segment inside geometry shader. But mantra got crash.

GU_Detail *gdpCurve = new GU_Detail;

gdpCurve->copy(*gdpSkin);

GU_PrimRBezCurve *shaft = GU_PrimRBezCurve::build(gdpCurve, 1, 4, 0, 0);

{

int ind1, ind2;

GU_Curve *temp = shaft->cut(0, 1, ind1, ind2, 0);

GEO_Curve *test = (GEO_Curve*)temp;

float size = test->arcLength(0.1,0.5, 0, 1);

}

or

{

GEO_Curve *test = shaft ->getCurve();

float size = test->arcLength(0.1, 0.5, 0, 1);

}

Link to comment
Share on other sites

Ok, guys. Something awful.

const GU_Detail *cgdpSkin = new GU_Detail;

..................................

cgdpSkin = queryGeometry(handleSkin, samplesSkin);

GU_Detail *gdpSkin = (GU_Detail*)cgdpSkin;

GU_Detail *gdpCurve = new GU_Detail;

gdpCurve->copy(*gdpSkin);

GU_PrimNURBCurve *shaft = new GU_PrimNURBCurve(gdpCurve);

shaft = GU_PrimNURBCurve::build(gdpCurve, 4, 4, 0, 1, 1);

float start, end;

shaft->validRange(start, end);

std::cout << "start: " << start << " end: " << end << std::endl;

float arcLenCurve = shaft->arcLength(0, 1, 0, 10);

std::cout << "arcLenCurve: " << arcLenCurve << std::endl;

UT_Vector4 testpos;

int test = shaft->evaluatePoint(testpos, 0.5);

std::cout << "test: " << test << std::endl;

std::cout << "x:" << testpos.x() << " y:" << testpos.y() << " z:" << testpos.z() << std::endl;

And all results:

start: 0 end: 2

arcLenCurve: 0

test: 0

x:0 y:0 z:0

Bad results. I want to take curve from sops and to create the same curve into my procedural. And than to calculate length of this curve and lengths of its segments.

Does anyone know what is wrong?

Thanks

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...