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);
}
Arc length
5727 10 1- Wish
- Member
- 282 posts
- Joined: Jan. 2006
- Offline
- Wish
- Member
- 282 posts
- Joined: Jan. 2006
- Offline
- Wish
- Member
- 282 posts
- Joined: Jan. 2006
- Offline
- Wish
- Member
- 282 posts
- Joined: Jan. 2006
- Offline
- mondi
- Member
- 44 posts
- Joined: July 2005
- Offline
Some NURB stuff gave me -1 or 0 arc length
Since the examples are a little varied, I'd just like to confirm a couple of things..
1 - Are you still getting a crash, or is the issue just the arcLength now.
2 - From your first example, which is the only place I can see where you assign any external data to the curve, what is gdpSkin? Is there any data there? Could you post a little more of the surrounding code?
3 - In the last example, do you get -1 or 0 as the length, it's a bit ambiguous, and they mean quite different things
- Wish
- Member
- 282 posts
- Joined: Jan. 2006
- Offline
Hey Mondi!
I'm getting crash on the arcLenght.
gdpSkin is a quired sop geometry(a NURBS).
The task is simple. To take geo(NURB curve) from sops into geoshader(done). To convert this geo to temp NURB curve inside this shader and to calculate the length of the segment of this curve.
-1(error, as I now) - when I take borders of arc smth like u0 = 0.5, u1 = 0.8. And 0 if u0 = 0, u1 = 1;
I'm getting crash on the arcLenght.
gdpSkin is a quired sop geometry(a NURBS).
The task is simple. To take geo(NURB curve) from sops into geoshader(done). To convert this geo to temp NURB curve inside this shader and to calculate the length of the segment of this curve.
-1(error, as I now) - when I take borders of arc smth like u0 = 0.5, u1 = 0.8. And 0 if u0 = 0, u1 = 1;
Houdini is great! O'right?
- Wish
- Member
- 282 posts
- Joined: Jan. 2006
- Offline
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
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
Houdini is great! O'right?
- mondi
- Member
- 44 posts
- Joined: July 2005
- Offline
- Wish
- Member
- 282 posts
- Joined: Jan. 2006
- Offline
Hi, Mondi.
I found the core of my problem. This is not the arc length method. This is converting from gudetail geometry, which quered into procedural from obj, into GU_PrimNURBCurve.
GU_Detail *gdpSkin = (GU_Detail*)queryGeometry(handleSkin, samplesSkin);
GEO_PrimNURBCurve *gdpCurve = new GEO_PrimNURBCurve(gdpSkin);
gdpCurve = GU_PrimNURBCurve::build(gdpSkin, 4, 4, 0, 1, 1);
I' m sure that curve is ok, but all curves points is in the origin and not in positions of curve object, which is quered
I found the core of my problem. This is not the arc length method. This is converting from gudetail geometry, which quered into procedural from obj, into GU_PrimNURBCurve.
GU_Detail *gdpSkin = (GU_Detail*)queryGeometry(handleSkin, samplesSkin);
GEO_PrimNURBCurve *gdpCurve = new GEO_PrimNURBCurve(gdpSkin);
gdpCurve = GU_PrimNURBCurve::build(gdpSkin, 4, 4, 0, 1, 1);
I' m sure that curve is ok, but all curves points is in the origin and not in positions of curve object, which is quered
Houdini is great! O'right?
- mondi
- Member
- 44 posts
- Joined: July 2005
- Offline
- Wish
- Member
- 282 posts
- Joined: Jan. 2006
- Offline
-
- Quick Links