Package org.eclipse.mosaic.lib.spatial
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 theVector3d
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, usePointCloud.PointReference.ABSOLUTE
. If the reference frame of the points areorigin
andorientation
, then usePointCloud.PointReference.RELATIVE
.
getRelativeEndPoints()
orgetAbsoluteEndPoints()
, 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 ofgetAbsoluteEndPoints()
will return the stored point list as-is, whereas a call ofgetRelativeEndPoints()
will transform the stored points to relative coordinates (relatively toorigin
andorientation
).- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PointCloud.Point
APointCloud.Point
of the point cloud consists of its coordinates, an identifier of the type of object the point has hit, and the distance to the point cloud origin.static class
PointCloud.PointReference
-
Constructor Summary
Constructors Constructor Description PointCloud(long creationTime, Vector3d origin, RotationMatrix orientation, List<PointCloud.Point> points, PointCloud.PointReference pointsReference)
Creates a new PointCloud based on a list ofPointCloud.Point
s.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<PointCloud.Point>
getAbsoluteEndPoints()
Returns all end points of all rays of thisPointCloud
in absolute coordinates.List<PointCloud.Point>
getAbsoluteEndPointsWithHit()
Returns all end points of all rays of thisPointCloud
that hit something in absolute coordinates.long
getCreationTime()
Returns the simulation time when thePointCloud
was created.RotationMatrix
getOrientation()
Returns the orientation of the point cloud asRotationMatrix
.Vector3d
getOrigin()
Returns the origin point of this point cloud in absolute world coordinates.PointCloud.PointReference
getReferenceFormat()
Returns the type of reference frame the points are stored in this point cloud internally.List<PointCloud.Point>
getRelativeEndPoints()
Returns all end points of all rays of thisPointCloud
that hit something in relative coordinates.List<PointCloud.Point>
getRelativeEndPointsWithHit()
Returns all end points of all rays of thisPointCloud
that hit something in relative coordinates.
-
-
-
Constructor Detail
-
PointCloud
public PointCloud(long creationTime, Vector3d origin, RotationMatrix orientation, List<PointCloud.Point> points, PointCloud.PointReference pointsReference)
Creates a new PointCloud based on a list ofPointCloud.Point
s. 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 givenPointCloud.Point
list must be declared by usingPointCloud.PointReference.ABSOLUTE
orPointCloud.PointReference.RELATIVE
.- Parameters:
creationTime
- the creation time of the point cloud in nanosecondsorigin
- the origin point of the point cloud in world coordinatesorientation
- the orientation of the point cloudpoints
- a list of points, containing point coordinates in either absolute or relative formatpointsReference
- the reference format of the coordinates of the points (absolute world coordinates, relative coordinates)
-
-
Method Detail
-
getCreationTime
public long getCreationTime()
Returns the simulation time when thePointCloud
was created.- Returns:
- time in nanoseconds
-
getOrigin
public Vector3d getOrigin()
Returns the origin point of this point cloud in absolute world coordinates. Points returned bygetRelativeEndPoints()
are relative to this origin.- Returns:
- origin of the rays forming this point cloud in absolute coordinates
- See Also:
getOrientation()
-
getOrientation
public RotationMatrix getOrientation()
Returns the orientation of the point cloud asRotationMatrix
. Points returned bygetRelativeEndPoints()
are relative togetOrigin()
and this orientation matrix. Points returned bygetAbsoluteEndPoints()
are translated and rotated usinggetOrigin()
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 isa = R * r + o
- Returns:
- rotation matrix R
- See Also:
returns o
-
getRelativeEndPoints
public List<PointCloud.Point> getRelativeEndPoints()
Returns all end points of all rays of thisPointCloud
that hit something in relative coordinates. Relative coordinates mean the use of a cartesian coordinate system with its origin at thePointCloud
's origin, returned bygetOrigin()
. In addition, the coordinate system is rotated. SeegetOrientation()
for details.- Returns:
- end points of all rays of this
PointCloud
in relative coordinates - See Also:
origin of ray / translation of coordinates
,rotation of coordinates
-
getRelativeEndPointsWithHit
public List<PointCloud.Point> getRelativeEndPointsWithHit()
Returns all end points of all rays of thisPointCloud
that hit something in relative coordinates. Relative coordinates mean the use of a cartesian coordinate system with its origin (0,0,0) at thePointCloud
's origin, returned bygetOrigin()
. In addition, the coordinate system is rotated. SeegetOrientation()
for details.- Returns:
- end points of all rays of this
PointCloud
in relative coordinates - See Also:
origin of ray / translation of coordinates
,rotation of coordinates
-
getAbsoluteEndPoints
public List<PointCloud.Point> getAbsoluteEndPoints()
Returns all end points of all rays of thisPointCloud
in absolute coordinates. Absolute coordinates represent world coordinates, and havegetOrigin()
andgetOrientation()
already applied.- Returns:
- a list of points in absolute coordinates
-
getAbsoluteEndPointsWithHit
public List<PointCloud.Point> getAbsoluteEndPointsWithHit()
Returns all end points of all rays of thisPointCloud
that hit something in absolute coordinates. Absolute coordinates represent world coordinates, and havegetOrigin()
andgetOrientation()
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 ofgetAbsoluteEndPoints()
andgetRelativeEndPoints()
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.
-
-