Build Extruded Shapes
Build Extruded Shapes
Motivation
Extruded shapes are very common
- Tubes, pipes, bars, vases, donuts
- Other tricky uses…
How can you do it:
- You can build extruded shapes using an IndexedFaceSet node.
- You can build extruded shapes more easily and efficiently using an Extrusion node.
Creating extruded shapes
Extruded shapes are described by:
- A 2-D cross-section
- A 3-D spine along which to sweep the cross-section
Extruded shapes are like long bubbles created with a bubble wand:
- The bubble wand’s outline is the cross-section
- The path along which you swing the wand is the spine
Syntax: Extrusion
An Extrusion geometry node creates extruded geometry:
- crossSection - 2-D cross-section
- spine - 3-D sweep path
- endCap and beginCap - cap ends
XML Encoding
1
2
3
4
5
6
7
8
9
<Shape>
<Appearance><!-- ... --></Appearance>
<Extrusion
crossSection='...'
spine='...'
endCap='true'
beginCap='true'
... />
</Shape>
Classic VRML Encoding
1
2
3
4
5
6
7
8
9
10
Shape {
appearance Appearance { ... }
geometry Extrusion {
crossSection [ ... ]
spine [ ... ]
endCap TRUE
beginCap TRUE
...
}
}
An Extrusion geometry node creates extruded geometry:
- solid - shape is solid
- ccw - faces are counter-clockwise
- convex - faces are convex
XML Encoding
1
2
3
4
5
6
7
8
<Shape>
<Appearance><!-- ... --></Appearance>
<Extrusion
...
solid='true'
ccw='true'
convex='true'/>
</Shape>
Classic VRML Encoding
1
2
3
4
5
6
7
8
9
Shape {
appearance Appearance { ... }
geometry Extrusion {
...
solid TRUE
ccw TRUE
convex TRUE
}
}
Squishing and twisting extruded shapes
You can scale the cross-section along the spine:
- Vases, musical instruments
- Surfaces of revolution
You can rotate the cross-section along the spine
- Twisting ribbons
Syntax: Extrusion
An Extrusion geometry node creates geometry using:
- scale - cross-section scaling per spine point
- orientation - cross-section rotation per spine point
XML Encoding
1
2
3
4
5
6
7
<Shape>
<Appearance><!-- ... --></Appearance>
<Extrusion
...
scale='...'
orientation='...'/>
</Shape>
Classic VRML Encoding
1
2
3
4
5
6
7
8
Shape {
appearance Appearance { ... }
geometry Extrusion {
...
scale [ ... ]
orientation [ ... ]
}
}
Summary
- An Extrusion node efficiently creates extruded shapes
- The crossSection field specifies the cross-section
- The spine field specifies the sweep path
- The scale and orientation fields specify scaling and rotation at each spine point
This post is licensed under CC BY 4.0 by the author.