Class GeometryUtilPtr


  • public class GeometryUtilPtr
    extends java.lang.Object
    Ptr stores a pointer and optionally takes ownership of the value.
    • Constructor Detail

      • GeometryUtilPtr

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

        public GeometryUtilPtr()
        Default constructor yielding a NULL-pointer.
      • GeometryUtilPtr

        public GeometryUtilPtr​(GeometryUtil ptr)
        Do not take ownership of ptr.

        ptr can be null.

        The constructor is implicit on purpose.
    • Method Detail

      • delete

        public void delete()
      • deref

        public GeometryUtil deref()
        The pointer stored in the object.
      • __ref__

        public GeometryUtil __ref__()
        Dereferencing operator.
      • getDeref

        public GeometryUtil getDeref()
        Member access operator.
      • isShared

        public boolean isShared()
        check if this Ptr has shared ownership or none
        ownership
        Returns:
        true if Ptr has shared ownership, false if it has no ownership.
      • isNull

        public boolean isNull()
        checks if the pointer is null
        Returns:
        Returns true if the pointer is null
      • estimateVolume

        public double estimateVolume​(VectorGeometryPtr geoms)
        Estimates the volume of a list of geometries.
        Note: If geometries are overlapping, the overlapping regions will count twice in the
        volume.
        Parameters:
        geoms - [in] the list of geometries.
        Returns:
        the total volume of the geometries.
      • estimateVolume

        public double estimateVolume​(TriMesh trimesh)
        Estimates the volume of a trimesh.
        Parameters:
        trimesh - [in] the trimesh.
        Returns:
        the total volume of the trimesh.
      • estimateInertiaCOG

        public SWIGTYPE_p_std__pairT_rw__math__Vector3DT_double_t_rw__math__InertiaMatrixT_double_t_t estimateInertiaCOG​(double mass,
                                                                                                                         VectorGeometryPtr geoms,
                                                                                                                         FramePtr ref,
                                                                                                                         State state,
                                                                                                                         Transform3D reftrans)
        Estimates the inertia and center of gravity (COG) of a list of geometries.

        The inertia is described relative to the ref coordinate system translated to COG.
        The reftrans parameter can however be used to transform the geometries.

        Parameters:
        mass - [in] the total mass of all geometries.
        geoms - [in] the list of geometries.
        ref - [in] the reference frame for the geometries (if NULL, it is assumed that
        the geometries are defined relative to the same frame).
        state - [in] state used to retrieve the current location of geometries relative to
        the reference frame (only used if ref is given).
        reftrans - [in] (optional) used to transform the geometry before calculation of the
        inertia.
        Returns:
        the center of gravity relative to the ref frame and the inertia around
        the center of gravity (in the coordinate frame of the ref frame).
      • estimateInertiaCOG

        public SWIGTYPE_p_std__pairT_rw__math__Vector3DT_double_t_rw__math__InertiaMatrixT_double_t_t estimateInertiaCOG​(double mass,
                                                                                                                         VectorGeometryPtr geoms,
                                                                                                                         FramePtr ref,
                                                                                                                         State state)
        Estimates the inertia and center of gravity (COG) of a list of geometries.

        The inertia is described relative to the ref coordinate system translated to COG.
        The reftrans parameter can however be used to transform the geometries.

        Parameters:
        mass - [in] the total mass of all geometries.
        geoms - [in] the list of geometries.
        ref - [in] the reference frame for the geometries (if NULL, it is assumed that
        the geometries are defined relative to the same frame).
        state - [in] state used to retrieve the current location of geometries relative to
        the reference frame (only used if ref is given).

        Returns:
        the center of gravity relative to the ref frame and the inertia around
        the center of gravity (in the coordinate frame of the ref frame).
      • estimateInertia

        public InertiaMatrixd estimateInertia​(double mass,
                                              VectorGeometryPtr geoms,
                                              FramePtr ref,
                                              State state,
                                              Transform3D reftrans)
        Estimates the inertia of a list of geometries.

        The inertia is described relative to the ref coordinate system
        The reftrans parameter can however be used to transform the geometries.

        Parameters:
        mass - [in] the total mass of all geometries.
        geoms - [in] the list of geometries.
        ref - [in] the reference frame for the geometries (if NULL, it is assumed that
        the geometries are defined relative to the same frame).
        state - [in] state used to retrieve the current location of geometries relative to
        the reference frame (only used if ref is given).
        reftrans - [in] (optional) used to transform the geometry before calculation of the
        inertia.
        Returns:
        the inertia around relative to the ref frame.
      • estimateInertia

        public InertiaMatrixd estimateInertia​(double mass,
                                              VectorGeometryPtr geoms,
                                              FramePtr ref,
                                              State state)
        Estimates the inertia of a list of geometries.

        The inertia is described relative to the ref coordinate system
        The reftrans parameter can however be used to transform the geometries.

        Parameters:
        mass - [in] the total mass of all geometries.
        geoms - [in] the list of geometries.
        ref - [in] the reference frame for the geometries (if NULL, it is assumed that
        the geometries are defined relative to the same frame).
        state - [in] state used to retrieve the current location of geometries relative to
        the reference frame (only used if ref is given).

        Returns:
        the inertia around relative to the ref frame.
      • estimateInertia

        public InertiaMatrixd estimateInertia​(double mass,
                                              VectorGeometryPtr geoms,
                                              Transform3D reftrans)
        Estimates the inertia of a list of geometries.

        The inertia is described relative to the geometry reference frame.
        The reftrans parameter can however be used to transform the geometries.

        Note: The geometries should be defined relative to the same frame - otherwise the
        result will not make sense.

        Parameters:
        mass - [in] the total mass of all geometries.
        geoms - [in] the list of geometries.
        reftrans - [in] (optional) used to transform the geometry before calculation of the
        inertia.
        Returns:
        the inertia matrix relative to the reference frame.
      • estimateInertia

        public InertiaMatrixd estimateInertia​(double mass,
                                              VectorGeometryPtr geoms)
        Estimates the inertia of a list of geometries.

        The inertia is described relative to the geometry reference frame.
        The reftrans parameter can however be used to transform the geometries.

        Note: The geometries should be defined relative to the same frame - otherwise the
        result will not make sense.

        Parameters:
        mass - [in] the total mass of all geometries.
        geoms - [in] the list of geometries.

        Returns:
        the inertia matrix relative to the reference frame.
      • estimateCOG

        public Vector3D estimateCOG​(VectorGeometryPtr geoms)
        Estimates the center of gravity (COG) of a list of geometries.

        The COG will be found relative to the geometry frame.

        Note: The geometries should be defined relative to the same frame - otherwise the
        result will not make sense.

        Parameters:
        geoms - [in] the list of geometries.
        Returns:
        the center of gravity for the geometries.
      • estimateCOG

        public Vector3D estimateCOG​(VectorGeometryPtr geoms,
                                    FramePtr ref,
                                    State state)
        Estimates the center of gravity (COG) of a list of geometries.

        The COG will be given relative to the given reference frame.

        Parameters:
        geoms - [in] the list of geometries.
        ref - [in] the reference frame.
        state - [in] the state which gives the position of the geometries relative to the
        reference frame.
        Returns:
        the center of gravity for the geometries.
      • estimateCOG

        public Vector3D estimateCOG​(TriMesh trimesh,
                                    Transform3D t3d)
        Estimates the center of gravity (COG) of a triangle mesh.
        Parameters:
        trimesh - [in] the triangle mesh.
        t3d - [in] (optional) make a transformation of the trimesh.
        Returns:
        the center of gravity of the mesh.
      • estimateCOG

        public Vector3D estimateCOG​(TriMesh trimesh)
        Estimates the center of gravity (COG) of a triangle mesh.
        Parameters:
        trimesh - [in] the triangle mesh.

        Returns:
        the center of gravity of the mesh.
      • calcMaxDist

        public double calcMaxDist​(VectorGeometryPtr geoms,
                                  Vector3D center,
                                  FramePtr ref,
                                  State state)
        calculates the max distance to any triangle in the geoms, from some point
        center
        Parameters:
        geoms - [in] the geometries containing the triangles
        center - [in] the point to calculate the distance from
        ref - [in] the reference frame.
        state -
        Returns:
        the maximum distance to any triangle in the geometries
      • getAnchoredFrames

        public FrameVector getAnchoredFrames​(Frame f,
                                             State state)
        util function that locates all frames that is staticly connected to f
        and that has geometry information.
      • getAnchoredChildFrames

        public FrameVector getAnchoredChildFrames​(FramePtr parent,
                                                  State state)
        util function that locates all frames in the sub tree of parent
        that is staticly connected and that has geometry information.
      • getDimensions

        public Vector3D getDimensions​(GeometryPtr geometry)
        Returns the dimensions of geometry
        Parameters:
        geometry - [in] Geometry to analyse
        Returns:
        Dimensions in the x,y and z directions.
      • getDimensions

        public Vector3D getDimensions​(TriMeshPtr trimesh)
        Returns the dimensions of trimesh
        Parameters:
        trimesh - [in] TriMesh to analyse
        Returns:
        Dimensions in the x,y and z directions.