public class Triangle3d extends Object
Constructor and Description |
---|
Triangle3d(Coords3d point1,
Coords3d point2,
Coords3d point3)
Created the triangle by defining the three corner.
|
Modifier and Type | Method and Description |
---|---|
static Triangle3d |
fromByteArray(ByteBuffer bb)
Reads the given byte buffer and creates a triangle based on its content.
|
List<Coords3d> |
getPoints()
Returns with the corners of the triangle as a list.
|
static List<Triangle3d> |
getTriangles(Coords3d... coords)
Creates a list of triangles which covers the polygon defined by the given list of coordinates.
|
static List<Triangle3d> |
getTriangles(List<Coords3d> coords)
Creates a list of triangles which covers the polygon defined by the given list of coordinates.
|
void |
toByteArray(ByteBuffer byteBuffer)
Writes the byte array representation of this triangle to the given buffer.
|
String |
toTriangleString(List<Coords3d> coords)
Renders the triangle as is used by OpenSCAD: three index of a list of points -
that's why this method requires a coordinate list as a parameter.
|
public Triangle3d(Coords3d point1, Coords3d point2, Coords3d point3) throws IllegalValueException
point1
- the first cornerpoint2
- the second cornerpoint3
- the third cornerIllegalValueException
- if any of the parameters is nullpublic static Triangle3d fromByteArray(ByteBuffer bb)
toByteArray(ByteBuffer)
.bb
- the byte buffer the content will be read frompublic static List<Triangle3d> getTriangles(List<Coords3d> coords)
coords
- the list of coordinates used to generate the trianglesIllegalValueException
- if the given coords list is null or the list contains less than three coordinatespublic static List<Triangle3d> getTriangles(Coords3d... coords)
coords
- the list of coordinates used to generate the trianglesIllegalValueException
- if the given coords list is null or the list contains less than three coordinatespublic List<Coords3d> getPoints()
public String toTriangleString(List<Coords3d> coords) throws IllegalValueException
coords
- the list of coordinates which is used to determine the indexesIllegalValueException
- if any of the three corners of the triangle cannot be
found in the given listpublic void toByteArray(ByteBuffer byteBuffer)
byteBuffer
- the byte buffer the representation of this vertex will be written toCopyright © 2014–2020, Printing in 3D. All rights reserved.