Skip to content

CurvesPrimitive : Add WrapMode enum#1526

Open
johnhaddon wants to merge 16 commits intoImageEngine:mainfrom
johnhaddon:curvePinning
Open

CurvesPrimitive : Add WrapMode enum#1526
johnhaddon wants to merge 16 commits intoImageEngine:mainfrom
johnhaddon:curvePinning

Conversation

@johnhaddon
Copy link
Member

This extends the pre-existing periodic/nonperiodic boolean to support the additional concept of a Pinned wrap mode as defined by UsdGeomBasisCurves. This defines implicit "phantom vertices" to ensure that the rendered/evaluated curve interpolates all the way to its endpoints without having to manually double up points. It is so much nicer to work with, and I have no idea why we haven't all been doing this all along.

There are knock-on effects to a bunch of curve-consuming code, and there I've focussed most on those I know to be relevant to Gaffer. I'm sure performance could be improved in places, but I hope this is in a reasonable place to merge as a first pass, so I can get onto some more pressing priorities.

I'll open a companion PR for Gaffer shortly, so you'll be able to test this all in practice.

This generalises the periodic/nonperiodic concept and adds a Pinned value to line up with USD's pinned wrap mode.
I don't know how I ever coped editing them the way they were formatted before.
This is currently taking the cheap and cheerful approach of converting to NonPeriodic on construction, which does mean that the client has to be careful to use `CurvesPrimitiveEvaluator::primitive()` for retrieving primitive variables rather than the original primitive.

An alternative here would be to throw if the curves are pinned, and require the client to do the conversion externally. That's currently what MeshPrimitiveEvaluator does for non-triangle meshes, so there is some precedent.
These are nice and simple, because Varying and Vertex have the same variable size. This also revealed a bug in our handling of linear curves, where the same applies.
@johnhaddon
Copy link
Member Author

Debug build is failing an assertion :

test (CurvesAlgoTest.CurvesAlgoConvertPinnedToNonPeriodicTest.test) ... python: include/IECore/Interpolator.inl:44: void IECore::LinearInterpolator<T>::operator()(const T&, const T&, double, T&) const [with T = Imath_3_1::Vec3<float>]: Assertion `x <= 1.0' failed.

Seems it might be reasonable to just remove the assertion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant