public class PolygonalTubeFactory extends TubeFactory
TubeFactory
implements a simple tubing strategy
based on fitting together cylindrical pieces around each segment of the underlying curve.
The cylindrical segment which tubes the segment joining vertex vi to vertex vi+1 is
defined as follows. Let L be the line joining the two points, and let Pi
be the angle bisector of the segments which meet at vi. Then C is the segment
of the infinite cylinder around L cut out by the two planes
Pi and Pi+1.
The tube factory attempts to detect that the curve is closed by inspecting the first and
last points for equality (within a standard tolerance). You can also force the
curve to be closed with the TubeFactory.setClosed(boolean)
method.
Then the effect is as if a final point had been appended that is equal to the first one.
The cylinder's cross section is set by TubeFactory.setCrossSection(double[][])
.
Other aspects of the resulting polygonal tube are controlled by the other
set methods documented in TubeFactory
.
The resulting geometry can be gotten after the call to update()
, via the
getTube()
method.
IndexedLineSet ils = IndexedLineSetUtility.discreteTorusKnot(1,.25, 2, 9, 250)
PolygonalTubeFactory ptf = new PolygonalTubeFactory(ils, 0);
ptf.setClosed(true);
ptf.setVertexColorsEnabled(true);
ptf.setRadius(.04);
ptf.setCrossSection(mysection);
ptf.setTwists(6);
ptf.update();
IndexedFaceSet torus1Tubes = ptf.getTube();
SceneGraphComponent sgc = new SceneGraphComponent();
sgc.setGeometry(torus1Tubes);
closedCurve, crossSection, edgeColors, extendAtEnds, frameFieldType, framesDirty, generateTextureCoordinates, metric, radii, radius, theCurve, twists, userBinormals, userTangents, vertexColors, vertexColorsEnabled
Constructor and Description |
---|
PolygonalTubeFactory(double[][] curve) |
PolygonalTubeFactory(IndexedLineSet ils,
int whichCurve) |
Modifier and Type | Method and Description |
---|---|
IndexedFaceSet |
getTube()
This returns the current state of the tube geometry, as of the last call to
update() . |
void |
update()
Update the state of the output tube to reflect the current state of all settable variables.
|
void |
updateFrames() |
getFrameField, getFramesSceneGraphRepresentation, getInitialBinormal, getSceneGraphRepresentation, getSceneGraphRepresentation, getTangents, getUserBinormals, getXYZAxes, isArcLengthTextureCoordinates, isExtendAtEnds, isGenerateEdges, isGenerateTextureCoordinates, isMatchClosedTwist, isRemoveDuplicates, makeFrameField, setArcLengthTextureCoordinates, setClosed, setCrossSection, setEdgeColors, setExtendAtEnds, setFrameField, setFrameFieldType, setGenerateEdges, setGenerateTextureCoordinates, setInitialBinormal, setMatchClosedTwist, setMetric, setRadii, setRadius, setRemoveDuplicates, setTangents, setTwists, setUserBinormals, setVertexColors, setVertexColorsEnabled
public PolygonalTubeFactory(double[][] curve)
public PolygonalTubeFactory(IndexedLineSet ils, int whichCurve)
public void update()
update
in class TubeFactory
public IndexedFaceSet getTube()
update()
.public void updateFrames()
updateFrames
in class TubeFactory