Class Surface3d

    • Constructor Detail

      • Surface3d

        public Surface3d​(Point3d[][] points)
                  throws NullPointerException,
                         DrawRuntimeException
        Construct a new Surface3d.
        Parameters:
        points - Point3d[][]; two dimensional array of points. The first index iterates over the individual triangles; the second index iterates of the points of a single triangle. The range of the second index must be 3.
        Throws:
        NullPointerException - when points is null, or any element in points is null
        DrawRuntimeException - when points is empty, or any element in points does not contain exactly three elements
    • Method Detail

      • getPoints

        public Iterator<? extends Point3d> getPoints()
        Retrieve, or generate all points that make up the object.
        Specified by:
        getPoints in interface Drawable<Point3d>
        Returns:
        Iterable<Point2d>; an iterator that generates all points that make up the object
      • size

        public int size()
        Retrieve the number of points that make up the object.
        Specified by:
        size in interface Drawable<Point3d>
        Returns:
        int; the number of points that make up the object
      • getBounds

        public Bounds3d getBounds()
        Retrieve the bounding box of the object.
        Specified by:
        getBounds in interface Drawable3d
        Returns:
        Bounds3d; the bounding box of the object
      • project

        public Drawable2d project()
                           throws DrawRuntimeException
        Project the object onto the z=0 plane.
        Specified by:
        project in interface Drawable3d
        Returns:
        Drawable2d; the projected object
        Throws:
        DrawRuntimeException - 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.
      • toString

        public String toString()
        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.
        Specified by:
        toString in interface Drawable<Point3d>
        Overrides:
        toString in class Object
        Returns:
        String; a string describing the Drawable
      • toString

        public String toString​(String doubleFormat,
                               boolean doNotIncludeClassName)
        Produce a String describing the Drawable.
        Specified by:
        toString in interface Drawable<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()
        Overrides:
        hashCode in class Object