Prism shape options object that extends OBJ_Generic3All and OBJ_FigurePrimitive
A prism base is defined in the XY plane, and it's length extends into +z. Use transform to orient it in any other way.
transform
Triangles will be created for the ends if the base is convex. If the base is not convex, use baseTriangles to define the triangles.
baseTriangles
To test examples, append them to the boilerplate
// Create a rectangular prismfigure.add( { make: 'prism', base: [[0, 0], [0.5, 0], [0.5, 0.2], [0, 0.2]], color: [1, 0, 0, 1], },); Copy
// Create a rectangular prismfigure.add( { make: 'prism', base: [[0, 0], [0.5, 0], [0.5, 0.2], [0, 0.2]], color: [1, 0, 0, 1], },);
// Create a hexagonal prism along the x axis with linesfigure.add( { make: 'prism', base: Fig.polygon({ radius: 0.1, sides: 6 }), color: [1, 0, 0, 1], transform: ['r', Math.PI / 2, 0, 1, 0], lines: true, },); Copy
// Create a hexagonal prism along the x axis with linesfigure.add( { make: 'prism', base: Fig.polygon({ radius: 0.1, sides: 6 }), color: [1, 0, 0, 1], transform: ['r', Math.PI / 2, 0, 1, 0], lines: true, },);
// Create a bow tie prism defining the base trianglesfigure.add( { make: 'prism', base: [[0, 0], [0.25, 0.1], [0.5, 0], [0.5, 0.3], [0.25, 0.2], [0, 0.3]], baseTriangles: [ [0, 0], [0.25, 0.1], [0.25, 0.2], [0, 0], [0.25, 0.2], [0, 0.3], [0.25, 0.1], [0.5, 0], [0.5, 0.3], [0.25, 0.1], [0.5, 0.3], [0.25, 0.2], ], color: [1, 0, 0, 1], transform: ['r', Math.PI / 2, 0, 1, 0], },);@interface Copy
// Create a bow tie prism defining the base trianglesfigure.add( { make: 'prism', base: [[0, 0], [0.25, 0.1], [0.5, 0], [0.5, 0.3], [0.25, 0.2], [0, 0.3]], baseTriangles: [ [0, 0], [0.25, 0.1], [0.25, 0.2], [0, 0], [0.25, 0.2], [0, 0.3], [0.25, 0.1], [0.5, 0], [0.5, 0.3], [0.25, 0.1], [0.5, 0.3], [0.25, 0.2], ], color: [1, 0, 0, 1], transform: ['r', Math.PI / 2, 0, 1, 0], },);@interface
Prism shape options object that extends OBJ_Generic3All and OBJ_FigurePrimitive
A prism base is defined in the XY plane, and it's length extends into +z. Use
transformto orient it in any other way.Triangles will be created for the ends if the base is convex. If the base is not convex, use
baseTrianglesto define the triangles.See
To test examples, append them to the boilerplate
Example
Example
Example