A Deformation of space transforming planes to cylinders. More...
#include <CylindricalDeformation.h>
Public Member Functions | |
CylindricalDeformation (float R) | |
Creates a new CylindricalDeformation. | |
virtual | ~CylindricalDeformation () |
Deletes this CylindricalDeformation. | |
virtual vec3d | localToDeformed (const vec3d &localPt) const |
Returns the deformed point corresponding to the given source point. | |
virtual mat4d | localToDeformedDifferential (const vec3d &localPt, bool clamp=false) const |
Returns the differential of the deformation function at the given local point. | |
virtual vec3d | deformedToLocal (const vec3d &worldPt) const |
Returns the local point corresponding to the given source point. | |
virtual box2f | deformedToLocalBounds (const vec3d &deformedCenter, double deformedRadius) const |
Returns the local bounding box corresponding to the given source disk. | |
virtual mat4d | deformedToTangentFrame (const vec3d &deformedPt) const |
Returns an orthonormal reference frame of the tangent space at the given deformed point. | |
virtual void | setUniforms (ptr< SceneNode > context, ptr< TerrainNode > n, ptr< Program > prog) const |
Sets the shader uniforms that are necessary to project on screen the TerrainQuad of the given TerrainNode. | |
virtual SceneManager::visibility | getVisibility (const TerrainNode *t, const box3d &localBox) const |
Returns the visibility of a bounding box in local space, in a view frustum defined in deformed space. | |
Public Attributes | |
const float | R |
The radius of the cylinder into which the plane z=0 must be deformed. |
A Deformation of space transforming planes to cylinders.
This deformation transforms the plane z=0 into a cylinder of radius R. The deformation of p=(x,y,z) in local space is q=(x, r.sin(a), r.cos(a)), where r=R-z and a=y/R.
proland::CylindricalDeformation::CylindricalDeformation | ( | float | R | ) |
Creates a new CylindricalDeformation.
R | the radius of the cylinder into which the plane z=0 must be deformed. |
virtual proland::CylindricalDeformation::~CylindricalDeformation | ( | ) | [virtual] |
Deletes this CylindricalDeformation.
virtual vec3d proland::CylindricalDeformation::deformedToLocal | ( | const vec3d & | deformedPt | ) | const [virtual] |
Returns the local point corresponding to the given source point.
deformedPt | a point in the deformed (i.e., destination) space. |
Reimplemented from proland::Deformation.
virtual box2f proland::CylindricalDeformation::deformedToLocalBounds | ( | const vec3d & | deformedCenter, | |
double | deformedRadius | |||
) | const [virtual] |
Returns the local bounding box corresponding to the given source disk.
deformedPt | the source disk center in deformed space. | |
deformedRadius | the source disk radius in deformed space. |
Reimplemented from proland::Deformation.
virtual mat4d proland::CylindricalDeformation::deformedToTangentFrame | ( | const vec3d & | deformedPt | ) | const [virtual] |
Returns an orthonormal reference frame of the tangent space at the given deformed point.
This reference frame is such that its xy plane is the tangent plane, at deformedPt, to the deformed surface corresponding to the local plane z=0. Note that this orthonormal reference frame does not give the differential of the inverse deformation funtion, which in general is not an orthonormal transformation. If p is a deformed point, then deformedToLocalFrame(deformedPt) * p gives the coordinates of p in the orthonormal reference frame defined above.
deformedPt | a point in the deformed (i.e., destination) space. |
Reimplemented from proland::Deformation.
virtual SceneManager::visibility proland::CylindricalDeformation::getVisibility | ( | const TerrainNode * | t, | |
const box3d & | localBox | |||
) | const [virtual] |
Returns the visibility of a bounding box in local space, in a view frustum defined in deformed space.
t | a TerrainNode. This is node is used to get the camera position in local and deformed space with TerrainNode::getLocalCamera and TerrainNode::getDeformedCamera, as well as the view frustum planes in deformed space with TerrainNode::getDeformedFrustumPlanes. | |
localBox | a bounding box in local space. |
Reimplemented from proland::Deformation.
virtual vec3d proland::CylindricalDeformation::localToDeformed | ( | const vec3d & | localPt | ) | const [virtual] |
Returns the deformed point corresponding to the given source point.
localPt | a point in the local (i.e., source) space. |
Reimplemented from proland::Deformation.
virtual mat4d proland::CylindricalDeformation::localToDeformedDifferential | ( | const vec3d & | localPt, | |
bool | clamp = false | |||
) | const [virtual] |
Returns the differential of the deformation function at the given local point.
This differential gives a linear approximation of the deformation around a given point, represented with a matrix. More precisely, if p is near localPt, then the deformed point corresponding to p can be approximated with localToDeformedDifferential(localPt) * (p - localPt).
localPt | a point in the local (i.e., source) space. The z coordinate of this point is ignored, and considered to be 0. |
Reimplemented from proland::Deformation.
virtual void proland::CylindricalDeformation::setUniforms | ( | ptr< SceneNode > | context, | |
ptr< TerrainNode > | n, | |||
ptr< Program > | prog | |||
) | const [virtual] |
Sets the shader uniforms that are necessary to project on screen the TerrainQuad of the given TerrainNode.
This method can set the uniforms that are common to all the quads of the given terrain.
context | the SceneNode to which the TerrainNode belongs. This node defines the absolute position and orientation of the terrain in world space (through SceneNode::getLocalToWorld). | |
n | a TerrainNode. |
Reimplemented from proland::Deformation.
const float proland::CylindricalDeformation::R |
The radius of the cylinder into which the plane z=0 must be deformed.