Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Is it possible to override the interpolation of the BezierShape (SDK)?

Is it possible to override the interpolation of the BezierShape (SDK)?

Anonymous
Not applicable
1,104 Views
9 Replies
Message 1 of 10

Is it possible to override the interpolation of the BezierShape (SDK)?

Anonymous
Not applicable

Is it possible to override the interpolation method of the BezierShape, so every new spline the user creates is conformed to a surface? Or is it possible to set the interpolated points of a spline?

 

So far I found this method:

ComputeBezPoints()

But since it's not virtual it can't be overridden. And about setting the interpolation points I found nothing, of course.

Any ideas about how I could accomplish this?

 

0 Likes
1,105 Views
9 Replies
Replies (9)
Message 2 of 10

istan
Advisor
Advisor
0 Likes
Message 3 of 10

Anonymous
Not applicable

Yeah, like that. I want my CustomSpline to behave like that but I don't know what should be overriden in order to do that.

0 Likes
Message 4 of 10

istan
Advisor
Advisor

Are you an ADN member? The debug version of Max comes with additional source code..

 

0 Likes
Message 5 of 10

Anonymous
Not applicable

Yes. Do you know of any good example in specific?

0 Likes
Message 6 of 10

istan
Advisor
Advisor

search for spline3d.cpp or splshape.cpp

0 Likes
Message 7 of 10

Anonymous
Not applicable

Actually, I still need help on this. I thought replacing Spline3D class with my own would work but now I see it's a mess of classes that try to emulate whatever max does but with my own interpolation. This approach leaded me to have Spline3D, BezierShape, SplineKnotAssy, and SplineKnot replaced, it's a mess!

 

I have somewhere else the points interpolated, based on a modified version of Catmull-Rom. I just need to know where to return all those points in Max code, so the spline is rendered based on them. So far I know that InterpBezier3D method will retrieve the interpolated points (right?). But what's the right place in SplineShape to change that?

 

Any idea on where to hack the interpolation without trying to replicate whatever Max does with all those classes?

@denisT.MaxDoctor, @istan@nicolas.fonta - some thoughts?

0 Likes
Message 8 of 10

denisT.MaxDoctor
Advisor
Advisor

tell us what your spline does have to do?  what operations with this spline do your want to provide?

the things you have override depend on a functionality of your spline. Technically you have to write your own ShapeObject.

For example, if you want to have a Catmull-Rom spline instead of Bezier you have to re-write all BezierShape. But you can convert from your spline Object to Bezier and back, you can extend the BezierShape. If there is no problem to convert from Catmull-Rom to Bezier, it's a problem to do it back.

 

 

0 Likes
Message 9 of 10

Anonymous
Not applicable

Thanks for replying, @denisT.MaxDoctor 

 

The goal: to have spline shapes that conform to a specific surface.

 

In order to do that, I started by creating a class derived from SplineShape. I needed this class to (1) insert knots conformed to the surface and (2) interpolate the spline shape based on this surface. I also recreated Spline3D class through my own "CustomSpline3D".

 

The number (1) worked by re-writing Spline3D::Interact. For the requirement (2), I tried changing Spline3D::MakePolyline, but surprisingly the method is never called. The possible reasons why the latter does not work are: either MakePolyline isn't the right method to change spline interpolation; or BezierShape is interfering with the call of CustomSpline3D::MakePolyline, instead it's executing Spline3D::MakePolyline.

 

After this long story, I want to know:

 

  • Is Spline3D::MakePolyline the right method to change the interpolation or is there something else I'm missing?
  • Is it necessary to recreate BezierShape class too, in order to have the right calls to our CustomSpline3D class? I tried this one and things got messy.
  • OR JUST HOW WOULD YOU DO IT? Because so the code is looking a bit messy  hahah 😞
     

Again, thank you very much for any help

0 Likes
Message 10 of 10

Anonymous
Not applicable

Sorry, I meant  Spline3D::ComputeBezPoints() instead of Spline3D::MakePolyline

0 Likes