Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::Plane Class Reference

Public Member Functions

 Plane (vec3 point, vec3 normal) noexcept
 
const vec3 & getPoint () const noexcept
 
const vec3 & getNormal () const noexcept
 
std::optional< vec3 > getIntersection (const vec3 &start, const vec3 &stop) const
 Get intersection point with plane and line segment. Intersects if plane is in between start and stop. Segement start point will be returned if segment lies in the plane.
 
std::optional< float > getIntersectionWeight (const vec3 &start, const vec3 &stop) const
 
float distance (const vec3 &x) const
 
vec3 projectPoint (const vec3 &x) const
 
bool isInside (const vec3 &point) const
 
bool perpendicularToPlane (const vec3 &) const
 
mat4 inPlaneBasis () const
 
void setPoint (const vec3)
 
void setNormal (const vec3 &)
 
Plane transform (const mat4 &transform) const
 
std::string getDataInfo () const
 

Static Public Attributes

static uvec3 COLOR_CODE
 
static const std::string CLASS_IDENTIFIER
 

Member Function Documentation

◆ distance()

float inviwo::Plane::distance ( const vec3 & x) const

Return signed distance from plane to point, i.e. dot(x - p, normal).

 Plane
   |
   p-> normal

x <-—|----> x (point) -d d

Returns
Negative distance if behind plane, positive otherwise.

◆ getIntersection()

std::optional< vec3 > inviwo::Plane::getIntersection ( const vec3 & start,
const vec3 & stop ) const

Get intersection point with plane and line segment. Intersects if plane is in between start and stop. Segement start point will be returned if segment lies in the plane.

Returned intersection point is invalid if no intersection exist.

Parameters
startStart point of segment
stopEnd point of segment
Returns
Intersected point if intersecting or nullopt.

◆ getIntersectionWeight()

std::optional< float > inviwo::Plane::getIntersectionWeight ( const vec3 & start,
const vec3 & stop ) const

Returns the intersection point as a fraction of the distance between start and stop. The point would be start + retval * (stop -start)

◆ inPlaneBasis()

mat4 inviwo::Plane::inPlaneBasis ( ) const

Calculate an basis in the plane, the normal will be the last component.

◆ isInside()

bool inviwo::Plane::isInside ( const vec3 & point) const

Check if point is on positive side of plane.

         Plane
           |
           |-> normal
 (outside) |  (inside)
See also
Plane::distance
Parameters
pointto check
Returns
true if on positive side of normal or on the plane, otherwise false

◆ projectPoint()

vec3 inviwo::Plane::projectPoint ( const vec3 & x) const

Project point onto plane. Plane | |-> normal projection |<-— x (point)

Parameters
xPoint to project
Returns
point on the plane

The documentation for this class was generated from the following file: