OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Protected Attributes | List of all members
ossimSonomaSensor::ossimPlane Class Reference

#include <ossimSonomaSensor.h>

Public Member Functions

 ossimPlane (double nx=0, double ny=0, double nz=1.0, double offset=1.0)
 
bool intersect (ossimDpt3d &result, ossimDpt3d &origin, ossimDpt3d &ray)
 
void setOffset (double offset)
 

Protected Attributes

double m_nx
 
double m_ny
 
double m_nz
 
double m_offset
 

Detailed Description

Definition at line 122 of file ossimSonomaSensor.h.

Constructor & Destructor Documentation

◆ ossimPlane()

ossimSonomaSensor::ossimPlane::ossimPlane ( double  nx = 0,
double  ny = 0,
double  nz = 1.0,
double  offset = 1.0 
)
inline

Definition at line 125 of file ossimSonomaSensor.h.

Member Function Documentation

◆ intersect()

bool ossimSonomaSensor::ossimPlane::intersect ( ossimDpt3d result,
ossimDpt3d origin,
ossimDpt3d ray 
)
inline

Definition at line 133 of file ossimSonomaSensor.h.

References ossim::almostEqual(), ossimDpt3d::x, ossimDpt3d::y, and ossimDpt3d::z.

Referenced by ossimSonomaSensor::intersectRay(), and ossimSonomaSensor::intersectRayWithHeight().

134  {
135  // P*N + D = 0;
136  // solve for parametric t:
137  // P = P0+t*ray
138  //
139  // (P0 + t*ray)*N + D = 0
140  // (P0*N + P0*ray*t + D = 0;
141  // t = -(D + P0*N)/(N*ray)
142  // if(t >= 0.0 then intersection
143 
144  double numerator = m_offset + origin.x*m_nx+origin.y*m_ny + origin.z*m_nz;
145  double denominator = ray.z*m_nx + ray.y*m_ny + ray.z*m_nz;
146  if(ossim::almostEqual(denominator, 0.0))
147  {
148  return false;
149  }
150 
151  double t = -numerator/denominator;
152  result.x = origin.x + t*ray.x;
153  result.y = origin.y + t*ray.y;
154  result.z = origin.z + t*ray.z;
155 
156  return true;
157  }
bool almostEqual(T x, T y, T tolerance=FLT_EPSILON)
Definition: ossimCommon.h:53
double z
Definition: ossimDpt3d.h:145
double x
Definition: ossimDpt3d.h:143
virtual ossimGpt origin() const
double y
Definition: ossimDpt3d.h:144

◆ setOffset()

void ossimSonomaSensor::ossimPlane::setOffset ( double  offset)
inline

Definition at line 159 of file ossimSonomaSensor.h.

Referenced by ossimSonomaSensor::intersectRay().

160  {
161  m_offset = offset;
162  }

Member Data Documentation

◆ m_nx

double ossimSonomaSensor::ossimPlane::m_nx
protected

Definition at line 164 of file ossimSonomaSensor.h.

◆ m_ny

double ossimSonomaSensor::ossimPlane::m_ny
protected

Definition at line 164 of file ossimSonomaSensor.h.

◆ m_nz

double ossimSonomaSensor::ossimPlane::m_nz
protected

Definition at line 164 of file ossimSonomaSensor.h.

◆ m_offset

double ossimSonomaSensor::ossimPlane::m_offset
protected

Definition at line 165 of file ossimSonomaSensor.h.


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