Package org.djutils.draw.surface
Class Surface3d
java.lang.Object
org.djutils.draw.surface.Surface3d
- All Implemented Interfaces:
Serializable
,Drawable<Point3d>
,Drawable3d
Surface3d.java. Triangulated surface in 3D space.
Copyright (c) 2021-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUTILS License.
- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Retrieve the bounding box of the object.Retrieve, or generate all points that make up the object.int
hashCode()
project()
Project the object onto the z=0 plane.int
size()
Retrieve the number of points that make up the object.toString()
Produce a string describing the Drawable using default conversion for the (double) coordinate values.Produce a String describing the Drawable.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.djutils.draw.Drawable
getPointList, toString, toString
Methods inherited from interface org.djutils.draw.Drawable3d
getDimensions
-
Constructor Details
-
Surface3d
Construct a new Surface3d.- Parameters:
points
- Point3d[][]; two dimensional array of points. The first index iterates over the individual triangles; the second index iterates over the points of a single triangle. The range of the second index must be 3. It is expected that all points appear multiple times in the points array, but never within the same sub-array.- Throws:
NullPointerException
- when points is null, or any element in points is nullDrawRuntimeException
- when points is empty, or any element in points does not contain exactly three different points
-
-
Method Details
-
getPoints
Description copied from interface:Drawable
Retrieve, or generate all points that make up the object. -
size
public int size()Description copied from interface:Drawable
Retrieve the number of points that make up the object. -
getBounds
Description copied from interface:Drawable3d
Retrieve the bounding box of the object.- Specified by:
getBounds
in interfaceDrawable3d
- Returns:
- Bounds3d; the bounding box of the object
-
project
Description copied from interface:Drawable3d
Project the object onto the z=0 plane.- Specified by:
project
in interfaceDrawable3d
- Returns:
- Drawable2d; the projected object
- Throws:
InvalidProjectionException
- when projecting onto the z=0 plane results in an invalid object. E.g. a Line3d that consists of points that all have the exact same x and y coordinates cannot be a line after projecting on the z=0 plane.DrawRuntimeException
-
toString
Description copied from interface:Drawable
Produce a string describing the Drawable using default conversion for the (double) coordinate values. Regrettably, it is not allowed to provide a default implementation here. -
toString
Description copied from interface:Drawable
Produce a String describing the Drawable.- Specified by:
toString
in interfaceDrawable<Point3d>
- Parameters:
doubleFormat
- String; a format string (something like "%6.3f") which will be used to render every coordinate value)doNotIncludeClassName
- boolean; if true; the output of toString is not prefixed by the class name. This is useful for concatenating the textual representation of lots of Drawables (e.g. an array, or a List).- Returns:
- String; textual representation of the Drawable
-
hashCode
public int hashCode() -
equals
-