Class Geometry


  • public class Geometry
    extends java.lang.Object

    a class for representing a geometry that is scaled
    and transformed, and which is attached to a frame.

    Each geometry must have a unique ID. This is either auto
    generated or specified by user. The ids are used in collision
    detection and other algorithms where the object need an association
    other than its memory address.
    • Constructor Detail

      • Geometry

        public Geometry​(long cPtr,
                        boolean cMemoryOwn)
      • Geometry

        public Geometry​(GeometryDataPtr data,
                        double scale)
        constructor - autogenerated id from geometry type.
        Parameters:
        data -
        scale -
      • Geometry

        public Geometry​(GeometryDataPtr data)
        constructor - autogenerated id from geometry type.
        Parameters:
        data -
      • Geometry

        public Geometry​(GeometryDataPtr data,
                        java.lang.String name,
                        double scale)
        constructor giving a specified id.
        Parameters:
        data - [in] pointer to geometry data
        name - [in] Unique name to be assigned for the geometry
        scale - [in] scaling factor
      • Geometry

        public Geometry​(GeometryDataPtr data,
                        java.lang.String name)
        constructor giving a specified id.
        Parameters:
        data - [in] pointer to geometry data
        name - [in] Unique name to be assigned for the geometry
      • Geometry

        public Geometry​(GeometryDataPtr data,
                        Transform3D t3d,
                        double scale)
        constructor - autogenerated id from geometry type.
        Parameters:
        data - [in] pointer to geometry data
        t3d - [in] transform
        scale - [in] scaling factor
      • Geometry

        public Geometry​(GeometryDataPtr data,
                        Transform3D t3d)
        constructor - autogenerated id from geometry type.
        Parameters:
        data - [in] pointer to geometry data
        t3d - [in] transform
    • Method Detail

      • getCPtr

        public static long getCPtr​(Geometry obj)
      • delete

        public void delete()
      • getScale

        public double getScale()
        gets the scaling factor applied when using this geometry
        Returns:
        the scale as double
      • setScale

        public void setScale​(double scale)
        set the scaling factor that should be applied to
        this geometry when used.
        Parameters:
        scale - [in] scale factor
      • setTransform

        public void setTransform​(Transform3D t3d)
        set transformation
        Parameters:
        t3d - [in] the new transform
      • getTransform

        public Transform3D getTransform()
        get transformation
        Returns:
        the Current transform
      • getGeometryData

        public GeometryDataPtr getGeometryData()
        get geometry data
        Returns:
        the geometry data stored
      • setGeometryData

        public void setGeometryData​(GeometryDataPtr data)
        set transformation
        Parameters:
        data - [in] the new geometry data
      • getName

        public java.lang.String getName()
        get name of this geometry
        Returns:
        name as string
      • getFilePath

        public java.lang.String getFilePath()
        get file path of this geometry
        Returns:
        the file path as string
      • getId

        public java.lang.String getId()
        get identifier of this geometry
        Returns:
        the id of the geometry
      • setName

        public void setName​(java.lang.String name)
        set name of this geometry
        Parameters:
        name - [in] the new name of the geometry
      • setFilePath

        public void setFilePath​(java.lang.String name)
        set file path this geometry
        Parameters:
        name - [in] path to a geometry file
      • setId

        public void setId​(java.lang.String id)
        set identifier of this geometry
        Parameters:
        id - [in] new id
      • setColor

        public void setColor​(short red,
                             short green,
                             short blue)
        set the color of the geometry
        Parameters:
        red - [in] the amount of red color 0-255
        green - [in] the amount of green color 0-255
        blue - [in] the amount of red color 0-255
      • setColor

        public void setColor​(float red,
                             float green,
                             float blue)
        set the color of the geometry
        Parameters:
        red - [in] the amount of red color 0-1
        green - [in] the amount of green color 0-1
        blue - [in] the amount of red color 0-1
      • setFrame

        public void setFrame​(FramePtr frame)
        Set the reference frame.
        Parameters:
        frame - [in] new reference frame.
      • getFrame

        public Frame getFrame()
        Get the reference frame.
        Returns:
        the reference frame.
      • setMask

        public void setMask​(int mask)
        Set the draw mask.
        Parameters:
        mask - [in] the draw mask.
      • getMask

        public int getMask()
        Get the draw mask.
        Returns:
        the draw mask.
      • makeSphere

        public static GeometryPtr makeSphere​(double radi)
        util function for creating a Sphere geometry
      • makeBox

        public static GeometryPtr makeBox​(double x,
                                          double y,
                                          double z)
        util function for creating a Box geometry
      • makeCone

        public static GeometryPtr makeCone​(double height,
                                           double radiusTop,
                                           double radiusBot)
        util function for creating a Cone geometry
      • makeCylinder

        public static GeometryPtr makeCylinder​(float radius,
                                               float height)
        util function for creating a Cylinder geometry
      • makeGrid

        public static GeometryPtr makeGrid​(int dim_x,
                                           int dim_y,
                                           double size_x,
                                           double size_y,
                                           Vector3D xdir,
                                           Vector3D ydir)
        Construct a grid.
        Parameters:
        dim_x - [in] number of cells in first direction.
        dim_y - [in] number of cells in second direction.
        size_x - [in] size of one cell.
        size_y - [in] size of one cell.
        xdir - [in] the direction of the first dimension.
        ydir - [in] the direction of the second dimension.
        Returns:
        a new grid geometry.
      • makeGrid

        public static GeometryPtr makeGrid​(int dim_x,
                                           int dim_y,
                                           double size_x,
                                           double size_y,
                                           Vector3D xdir)
        Construct a grid.
        Parameters:
        dim_x - [in] number of cells in first direction.
        dim_y - [in] number of cells in second direction.
        size_x - [in] size of one cell.
        size_y - [in] size of one cell.
        xdir - [in] the direction of the first dimension.

        Returns:
        a new grid geometry.
      • makeGrid

        public static GeometryPtr makeGrid​(int dim_x,
                                           int dim_y,
                                           double size_x,
                                           double size_y)
        Construct a grid.
        Parameters:
        dim_x - [in] number of cells in first direction.
        dim_y - [in] number of cells in second direction.
        size_x - [in] size of one cell.
        size_y - [in] size of one cell.


        Returns:
        a new grid geometry.
      • makeGrid

        public static GeometryPtr makeGrid​(int dim_x,
                                           int dim_y,
                                           double size_x)
        Construct a grid.
        Parameters:
        dim_x - [in] number of cells in first direction.
        dim_y - [in] number of cells in second direction.
        size_x - [in] size of one cell.



        Returns:
        a new grid geometry.
      • makeGrid

        public static GeometryPtr makeGrid​(int dim_x,
                                           int dim_y)
        Construct a grid.
        Parameters:
        dim_x - [in] number of cells in first direction.
        dim_y - [in] number of cells in second direction.




        Returns:
        a new grid geometry.
      • getColor

        public void getColor​(SWIGTYPE_p_float color)
        get the color stored for the object
        Parameters:
        color - [out] the array to store the color in