Class PointCloud

java.lang.Object
org.eclipse.mosaic.lib.spatial.PointCloud
All Implemented Interfaces:
Serializable

public final class PointCloud extends Object implements Serializable
This class represents a point cloud based on the Vector3d coordinate system.
  • It consists of a reference point which represents the origin/center of this point cloud in absolute world coordinates.
  • A rotation matrix used to translate relative end points of the point cloud to absolute coordinates.
  • A list of points (x,y,z, hit type, distance to origin) forming this point cloud.
  • Use one of the given PointCloud.PointReference formats to declare the reference frame of the given point lists. If they are already in absolute world coordinates, use PointCloud.PointReference.ABSOLUTE. If the reference frame of the points are origin and orientation, then use PointCloud.PointReference.RELATIVE.
When calling the methods getRelativeEndPoints() or getAbsoluteEndPoints(), a transformation of the stored points may be executed (and cached for re-use). E.g., if the point cloud is constructed using absolute coordinates (i.e. PointCloud.PointReference.ABSOLUTE), a call of getAbsoluteEndPoints() will return the stored point list as-is, whereas a call of getRelativeEndPoints() will transform the stored points to relative coordinates (relatively to origin and orientation).
See Also:
  • Constructor Details

    • PointCloud

      public PointCloud(long creationTime, Vector3d origin, RotationMatrix orientation, List<PointCloud.Point> points, PointCloud.PointReference pointsReference)
      Creates a new PointCloud based on a list of PointCloud.Points. The points may be given (and then stored) either in absolute world coordinates, or relative coordinates compared to the given origin and orientation field. The reference frame of the points in the given PointCloud.Point list must be declared by using PointCloud.PointReference.ABSOLUTE or PointCloud.PointReference.RELATIVE.
      Parameters:
      creationTime - the creation time of the point cloud in nanoseconds
      origin - the origin point of the point cloud in world coordinates
      orientation - the orientation of the point cloud
      points - a list of points, containing point coordinates in either absolute or relative format
      pointsReference - the reference format of the coordinates of the points (absolute world coordinates, relative coordinates)
  • Method Details

    • getCreationTime

      public long getCreationTime()
      Returns the simulation time when the PointCloud was created.
      Returns:
      time in nanoseconds
    • getOrigin

      public Vector3d getOrigin()
      Returns the origin point of this point cloud in absolute world coordinates. Points returned by getRelativeEndPoints() are relative to this origin.
      Returns:
      origin of the rays forming this point cloud in absolute coordinates
      See Also:
    • getOrientation

      public RotationMatrix getOrientation()
      Returns the orientation of the point cloud as RotationMatrix. Points returned by getRelativeEndPoints() are relative to getOrigin() and this orientation matrix. Points returned by getAbsoluteEndPoints() are translated and rotated using getOrigin() and this orientation matrix

      Let o be the ray origin in absolute coordinates, let R be the rotation matrix. Thus, the transformation of relative coordinates r into absolute coordinates a is a = R * r + o

      Returns:
      rotation matrix R
      See Also:
    • getRelativeEndPoints

      public List<PointCloud.Point> getRelativeEndPoints()
      Returns all end points of all rays of this PointCloud that hit something in relative coordinates. Relative coordinates mean the use of a cartesian coordinate system with its origin at the PointCloud's origin, returned by getOrigin(). In addition, the coordinate system is rotated. See getOrientation() for details.
      Returns:
      end points of all rays of this PointCloud in relative coordinates
      See Also:
    • getRelativeEndPointsWithHit

      public List<PointCloud.Point> getRelativeEndPointsWithHit()
      Returns all end points of all rays of this PointCloud that hit something in relative coordinates. Relative coordinates mean the use of a cartesian coordinate system with its origin (0,0,0) at the PointCloud's origin, returned by getOrigin(). In addition, the coordinate system is rotated. See getOrientation() for details.
      Returns:
      end points of all rays of this PointCloud in relative coordinates
      See Also:
    • getAbsoluteEndPoints

      public List<PointCloud.Point> getAbsoluteEndPoints()
      Returns all end points of all rays of this PointCloud in absolute coordinates. Absolute coordinates represent world coordinates, and have getOrigin() and getOrientation() already applied.
      Returns:
      a list of points in absolute coordinates
    • getAbsoluteEndPointsWithHit

      public List<PointCloud.Point> getAbsoluteEndPointsWithHit()
      Returns all end points of all rays of this PointCloud that hit something in absolute coordinates. Absolute coordinates represent world coordinates, and have getOrigin() and getOrientation() already applied.
      Returns:
      a list of points in absolute coordinates
    • getReferenceFormat

      public PointCloud.PointReference getReferenceFormat()
      Returns the type of reference frame the points are stored in this point cloud internally. The usage of getAbsoluteEndPoints() and getRelativeEndPoints() is independent of the value returned by this method, as transformation is already done internally if necessary. Therefore, it should usually not be required to use this method, except for (de)serialization use-cases.
      Returns:
      the PointCloud.PointReference type of the points stored in the point cloud.