de.jreality.geometry
Class PolygonalTubeFactory
java.lang.Object
de.jreality.geometry.TubeFactory
de.jreality.geometry.PolygonalTubeFactory
public class PolygonalTubeFactory
- extends TubeFactory
This subclass of 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);
- Author:
- Charles Gunn
| Fields inherited from class de.jreality.geometry.TubeFactory |
closedCurve, crossSection, edgeColors, extendAtEnds, frameFieldType, framesDirty, generateTextureCoordinates, metric, radii, radius, theCurve, twists, userBinormals, userTangents, vertexColors, vertexColorsEnabled |
|
Method Summary |
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()
|
| Methods inherited from class de.jreality.geometry.TubeFactory |
getFrameField, getFramesSceneGraphRepresentation, getSceneGraphRepresentation, getTangents, getUserBinormals, getXYZAxes, isArcLengthTextureCoordinates, isExtendAtEnds, isGenerateEdges, isGenerateTextureCoordinates, isMatchClosedTwist, isRemoveDuplicates, makeFrameField, setArcLengthTextureCoordinates, setClosed, setCrossSection, setEdgeColors, setExtendAtEnds, setFrameField, setFrameFieldType, setGenerateEdges, setGenerateTextureCoordinates, setMatchClosedTwist, setMetric, setRadii, setRadius, setRemoveDuplicates, setTangents, setTwists, setUserBinormals, setVertexColors, setVertexColorsEnabled |
PolygonalTubeFactory
public PolygonalTubeFactory(double[][] curve)
PolygonalTubeFactory
public PolygonalTubeFactory(IndexedLineSet ils,
int whichCurve)
update
public void update()
- Update the state of the output tube to reflect the current state of all settable variables.
- Overrides:
update in class TubeFactory
getTube
public IndexedFaceSet getTube()
- This returns the current state of the tube geometry, as of the last call to
update().
- Returns:
updateFrames
public void updateFrames()
- Overrides:
updateFrames in class TubeFactory