public class LinearExtrusion extends Entity implements IMeshConvertible
//Create a new 3D scene
Scene scene = new Scene();
// Initialize the base profile to be extruded
var profile = new RectangleShape();
profile.setRoundingRadius(0.3);
// Create left node
var left = scene.getRootNode().createChildNode();
left.createChildNode(new Box(0.01, 3, 3));
// Create right node
var right = scene.getRootNode().createChildNode();
right.createChildNode(new Box(0.01, 3, 3));
right.getTransform().setTranslation(new Vector3(5, 0, 0));
//Perform linear extrusion on left node using center and slices property
var l = new LinearExtrusion(profile, 10);
l.setCenter(false);
l.setSlices(3);
l.setTwist(20);
left.createChildNode(l);
// Perform linear extrusion on left node using center and slices property
var r = new LinearExtrusion(profile, 10);
r.setCenter(true);
r.setSlices(3);
r.setTwist(90);
right.createChildNode(r);
name, properties| Constructor and Description |
|---|
LinearExtrusion()
Constructor of instance
LinearExtrusion. |
LinearExtrusion(Profile shape,
double height)
Constructor of instance
LinearExtrusion. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
getCenter()
If this value is false, the linear extrusion Z range is from 0 to height, otherwise the range is from -height/2 to height/2.
|
Vector3 |
getDirection()
The direction of extrusion, default value is (0, 0, 1)
|
double |
getHeight()
The height of the extruded geometry, default value is 1.0
|
Profile |
getShape()
The base shape to be extruded.
|
int |
getSlices()
The slices of the twisted extruded geometry, default value is 1.
|
double |
getTwist()
The number of degrees of through which the shape is extruded.
|
Vector3 |
getTwistOffset()
The offset that used in twisting, default value is (0, 0, 0).
|
void |
setCenter(boolean value)
If this value is false, the linear extrusion Z range is from 0 to height, otherwise the range is from -height/2 to height/2.
|
void |
setDirection(Vector3 value)
The direction of extrusion, default value is (0, 0, 1)
|
void |
setHeight(double value)
The height of the extruded geometry, default value is 1.0
|
void |
setShape(Profile value)
The base shape to be extruded.
|
void |
setSlices(int value)
The slices of the twisted extruded geometry, default value is 1.
|
void |
setTwist(double value)
The number of degrees of through which the shape is extruded.
|
void |
setTwistOffset(Vector3 value)
The offset that used in twisting, default value is (0, 0, 0).
|
Mesh |
toMesh()
Convert the extrusion to mesh.
|
getBoundingBox, getExcluded, getParentNode, getParentNodes, setExcluded, setParentNodegetScenefindProperty, getName, getProperties, getProperty, removeProperty, removeProperty, setName, setPropertypublic LinearExtrusion()
LinearExtrusion.public LinearExtrusion(Profile shape, double height)
LinearExtrusion.public Profile getShape()
public void setShape(Profile value)
value - New valuepublic Vector3 getDirection()
public void setDirection(Vector3 value)
value - New valuepublic double getHeight()
public void setHeight(double value)
value - New valuepublic int getSlices()
public void setSlices(int value)
value - New valuepublic boolean getCenter()
public void setCenter(boolean value)
value - New valuepublic Vector3 getTwistOffset()
public void setTwistOffset(Vector3 value)
value - New valuepublic double getTwist()
public void setTwist(double value)
value - New valuepublic Mesh toMesh()
toMesh in interface IMeshConvertible