How to specify the starting orientation with ofxPtf?

Hi :slight_smile: Parallel Transport Frames allow us to create tubes that avoid gimbal lock issues. We can for instance extrude a pentagon around a wavy curve.

I’m having an issue though with animating the wavy curve. The result so far is correct in the spatial dimension (no unexpected mid-tube rotations), but not in the time dimension (the tube spins around it’s axis). You can see what happens in this video:

Can anyone think of a way to specify the initial orientation of the first frame to avoid the rotation?

To see the issue you can run the example https://github.com/neilmendoza/ofxPtf/blob/master/example/src/testApp.cpp , making numVerts = 5, adding this to recreate the path on each frame with a snake-like movement:

void testApp::update() {
	ptf.clear();
	for (int i = 0; i < 256; ++i) {
		ptf.addPoint(ofVec3f(-512 + i * 4, 100 * sin(i * 0.1f + ofGetElapsedTimef()), 0));
	}
}

The normals will flip regularly.

Update: after studying the code I think it might be the startNormal which jitters: https://github.com/neilmendoza/ofxPtf/blob/master/src/ParallelTransportFrames.cpp#L80 I’ll test that.