Package org.robwork.sdurw
Class ProjectionMatrix
- java.lang.Object
-
- org.robwork.sdurw.ProjectionMatrix
-
public class ProjectionMatrix extends java.lang.Object
projection matrix
-
-
Constructor Summary
Constructors Constructor Description ProjectionMatrix()
constructorProjectionMatrix(long cPtr, boolean cMemoryOwn)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete()
EigenMatrix4d
e()
get the boost matrix corresponding to this projectionpairDoubleDouble
getClipPlanes()
get near and far clipping planestatic long
getCPtr(ProjectionMatrix obj)
boolean
getFrustum(double left, double right, double bottom, double top, double zNear, double zFar)
get the projection matrix to the viewing frustum
boolean
getOrtho(double left, double right, double bottom, double top, double zNear, double zFar)
get ortographic projection.boolean
getPerspective(double fovy, double aspectRatio, double zNear, double zFar)
set the projection matrix to perspective projection
boolean
isOrtographicProjection()
test if this is a ortographic projection
boolean
isPerspectiveProjection()
test if this is a perspective projection
static ProjectionMatrix
makeOrtho(double left, double right, double bottom, double top, double zNear, double zFar)
creates a projection matrix with a orthographic projection
static ProjectionMatrix
makePerspective(double fovy, double aspectRatio, double zNear, double zFar)
creates a projection matrix with a perspective projection
static ProjectionMatrix
makePerspective(double fovy, double width, double height, double zNear, double zFar)
creates a projection matrix with a perspective projection
void
setFrustum(double left, double right, double bottom, double top, double zNear, double zFar)
set the projection matrix to the viewing frustum
void
setOrtho(double left, double right, double bottom, double top, double zNear, double zFar)
set the projection matrix to an ortographic projection by defining
the box with length to all sides (left, right, bottom, top, near and far)
void
setPerspective(double fovy, double aspectRatio, double zNear, double zFar)
set the projection matrix to perspective projection
void
setPerspective(double fovy, double width, double height, double zNear, double zFar)
set the projection matrix to perspective projection
-
-
-
Method Detail
-
getCPtr
public static long getCPtr(ProjectionMatrix obj)
-
delete
public void delete()
-
e
public EigenMatrix4d e()
get the boost matrix corresponding to this projection
-
isPerspectiveProjection
public boolean isPerspectiveProjection()
test if this is a perspective projection
- Returns:
- true if perspective projection, false otherwise.
-
isOrtographicProjection
public boolean isOrtographicProjection()
test if this is a ortographic projection
- Returns:
- true if ortographic projection, false otherwise.
-
setOrtho
public void setOrtho(double left, double right, double bottom, double top, double zNear, double zFar)
set the projection matrix to an ortographic projection by defining
the box with length to all sides (left, right, bottom, top, near and far)
- Parameters:
left
- [in] length in m to left edge of imageright
- [in] length in m to right edge of imagebottom
- [in] length in m to bottom edge of imagetop
- [in] length in m to top edge of imagezNear
- [in] length in m to near clipping planezFar
- [in] length in m to far clipping plane
-
getOrtho
public boolean getOrtho(double left, double right, double bottom, double top, double zNear, double zFar)
get ortographic projection. Onli valid if isOrtographicProjection is true
-
setFrustum
public void setFrustum(double left, double right, double bottom, double top, double zNear, double zFar)
set the projection matrix to the viewing frustum
- Parameters:
left
- [in] distance in m near cutting plane from center to left edgeright
- [in] distance in m near cutting plane from center to right edgebottom
- [in] distance in m near cutting plane from center to bottom edgetop
- [in] distance in m near cutting plane from center to top edgezNear
- [in] distance in m along z-axis to near cutting planezFar
- [in] distance in m along z-axis to far cutting plane
-
getFrustum
public boolean getFrustum(double left, double right, double bottom, double top, double zNear, double zFar)
get the projection matrix to the viewing frustum
- Parameters:
left
- [out] distance in m near cutting plane from center to left edgeright
- [out] distance in m near cutting plane from center to right edgebottom
- [out] distance in m near cutting plane from center to bottom edgetop
- [out] distance in m near cutting plane from center to top edgezNear
- [out] distance in m along z-axis to near cutting planezFar
- [out] distance in m along z-axis to far cutting plane
-
setPerspective
public void setPerspective(double fovy, double aspectRatio, double zNear, double zFar)
set the projection matrix to perspective projection
- Parameters:
fovy
- [in] vertical field of view [degrees]aspectRatio
- [in] aspect ratio between width and height of imagezNear
- [in] distance to near cutting planezFar
- [in] distance to far cutting plane
-
setPerspective
public void setPerspective(double fovy, double width, double height, double zNear, double zFar)
set the projection matrix to perspective projection
- Parameters:
fovy
- [in] vertical field of view [degrees]width
- [in] width of imageheight
- [in] height of imagezNear
- [in] distance to near cutting planezFar
- [in] distance to far cutting plane
-
getPerspective
public boolean getPerspective(double fovy, double aspectRatio, double zNear, double zFar)
set the projection matrix to perspective projection
- Parameters:
fovy
- [in] vertical field of view [degrees]aspectRatio
- [in] aspect ratio between width and height of imagezNear
- [in] distance to near cutting planezFar
- [in] distance to far cutting plane
-
makePerspective
public static ProjectionMatrix makePerspective(double fovy, double aspectRatio, double zNear, double zFar)
creates a projection matrix with a perspective projection
- Parameters:
fovy
- [in]aspectRatio
- [in]zNear
- [in]zFar
- [in]- Returns:
- new ProjectionMatrix.
-
makePerspective
public static ProjectionMatrix makePerspective(double fovy, double width, double height, double zNear, double zFar)
creates a projection matrix with a perspective projection
- Parameters:
fovy
- [in]width
- [in] of imageheight
- [in] of imagezNear
- [in]zFar
- [in]- Returns:
- new ProjectionMatrix.
-
makeOrtho
public static ProjectionMatrix makeOrtho(double left, double right, double bottom, double top, double zNear, double zFar)
creates a projection matrix with a orthographic projection
- Parameters:
left
- [in]right
- [in]bottom
- [in]top
- [in]zNear
- [in]zFar
- [in]- Returns:
- new ProjectionMatrix.
-
getClipPlanes
public pairDoubleDouble getClipPlanes()
get near and far clipping plane- Returns:
-
-