Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::Geometry::Plane Class Reference

Holds a simple Plane. More...

#include <Plane.h>

Inheritance diagram for Mantid::Geometry::Plane:
Mantid::Geometry::Quadratic Mantid::Geometry::Surface

Public Member Functions

void acceptVisitor (BaseVisit &A) const override
 Accept visitor for line calculation. More...
 
std::string className () const override
 Effective typename. More...
 
std::unique_ptr< Planeclone () const
 Makes a clone (implicit virtual copy constructor) More...
 
Kernel::V3D crossProd (const Plane &) const
 returns normal cross product More...
 
void displace (const Kernel::V3D &) override
 Displace the plane by Point Sp. More...
 
double distance (const Kernel::V3D &) const override
 distance from a point More...
 
double dotProd (const Plane &) const
 returns normal dot product More...
 
void getBoundingBox (double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) override
 Returns the bounding box values for plane, double max is infinity and double min is -infinity A very crude way of finding the bounding box but its very fast. More...
 
double getDistance () const
 Distance from origin. More...
 
const Kernel::V3DgetNormal () const
 Normal to plane (+ve surface) More...
 
int LineIntersectionWithPlane (Kernel::V3D startpt, Kernel::V3D endpt, Kernel::V3D &output)
 Returns the point of intersection of line with the plane. More...
 
bool onSurface (const Kernel::V3D &) const override
 Calcuate the side that the point is on and returns success if it is on the surface. More...
 
 Plane ()
 Constructor: sets plane in y-z plane and throught origin. More...
 
void print () const override
 Prints out the surface info and the Plane info. More...
 
void rotate (const Kernel::Matrix< double > &) override
 Rotate the plane about the origin by MA. More...
 
void setBaseEqn () override
 set up to be eqn based More...
 
int setPlane (const Kernel::V3D &, const Kernel::V3D &)
 Given a point and a normal direction set the plane. More...
 
int setSurface (const std::string &) override
 processes a standard MCNPX plane string: There are three types : More...
 
int side (const Kernel::V3D &) const override
 Calcualates the side that the point is on. More...
 
void write (std::ostream &) const override
 Write in MCNPX form. More...
 
- Public Member Functions inherited from Mantid::Geometry::Quadratic
void acceptVisitor (BaseVisit &A) const override
 Accept visitor for line calculation. More...
 
std::string className () const override
 Effective typeid. More...
 
std::unique_ptr< Quadraticclone () const
 
const std::vector< double > & copyBaseEqn () const
 access BaseEquation vector More...
 
void displace (const Kernel::V3D &) override
 Apply a general displacement to the surface. More...
 
double distance (const Kernel::V3D &) const override
 distance between point and surface (approx) More...
 
double eqnValue (const Kernel::V3D &) const
 Helper function to calcuate the value of the equation at a fixed point. More...
 
bool onSurface (const Kernel::V3D &) const override
 is point valid on surface More...
 
void print () const override
 Print out the genreal equation for debugging. More...
 
 Quadratic ()
 Constructor. More...
 
void rotate (const Kernel::Matrix< double > &) override
 Rotate the surface by matrix MX. More...
 
virtual void setBaseEqn ()=0
 Abstract set baseEqn. More...
 
int side (const Kernel::V3D &) const override
 Determine if the the Point is true to the surface or on the other side. More...
 
Kernel::V3D surfaceNormal (const Kernel::V3D &) const override
 Normal at surface. More...
 
void write (std::ostream &) const override
 Writes out an MCNPX surface description Note : Swap since base equation is swapped in gq output (mcnp 4c manual pg. More...
 
- Public Member Functions inherited from Mantid::Geometry::Surface
virtual void acceptVisitor (BaseVisit &A) const
 Accept visitor for line calculation. More...
 
virtual std::string className () const
 Effective typeid. More...
 
std::unique_ptr< Surfaceclone () const
 
virtual void displace (const Kernel::V3D &)=0
 translates the surface More...
 
virtual double distance (const Kernel::V3D &) const =0
 returns the minimum distance to the surface More...
 
virtual void getBoundingBox (double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin)=0
 bounding box for the surface More...
 
int getName () const
 Get Name. More...
 
virtual bool onSurface (const Kernel::V3D &R) const =0
 is point valid on surface More...
 
Surfaceoperator= (const Surface &)=delete
 
virtual void print () const
 Simple print out function for surface header. More...
 
virtual void rotate (const Kernel::Matrix< double > &)=0
 rotates the surface More...
 
void setName (int const N)
 Set Name. More...
 
virtual int setSurface (const std::string &R)=0
 Sets the surface based on a string input in MCNPX format. More...
 
virtual int side (const Kernel::V3D &) const
 Surface side : throw AbsObjMethod. More...
 
 Surface ()
 Constructor. More...
 
virtual Kernel::V3D surfaceNormal (const Kernel::V3D &) const =0
 returns the normal to the closest point on the surface More...
 
virtual void write (std::ostream &) const
 The writes the data to the output stream. More...
 
void writeHeader (std::ostream &) const
 Writes out the start of an MCNPX surface description . More...
 
virtual ~Surface ()=default
 

Protected Member Functions

Planeoperator= (const Plane &)=delete
 
 Plane (const Plane &)=default
 
- Protected Member Functions inherited from Mantid::Geometry::Quadratic
Quadraticoperator= (const Quadratic &)=delete
 
 Quadratic (const Quadratic &)=default
 
- Protected Member Functions inherited from Mantid::Geometry::Surface
 Surface (const Surface &)=default
 

Private Member Functions

PlanedoClone () const override
 Makes a clone (implicit virtual copy constructor) More...
 
std::size_t planeType () const
 are we alined on an axis More...
 

Private Attributes

double m_distance
 Distance from origin. More...
 
Kernel::V3D m_normVec
 Normal vector. More...
 

Additional Inherited Members

- Static Public Attributes inherited from Mantid::Geometry::Quadratic
static const int Nprecision = 10
 Precision of the output. More...
 
- Static Public Attributes inherited from Mantid::Geometry::Surface
static const int Nprecision = 10
 Precision of the output. More...
 
- Protected Attributes inherited from Mantid::Geometry::Quadratic
std::vector< double > BaseEqn
 Base equation (as a 10 point vector) More...
 

Detailed Description

Holds a simple Plane.

Author
S. Ansell
Date
April 2004
Version
1.0

Defines a plane and a normal and a distance from the origin

Definition at line 35 of file Plane.h.

Constructor & Destructor Documentation

◆ Plane() [1/2]

Mantid::Geometry::Plane::Plane ( const Plane )
protecteddefault

◆ Plane() [2/2]

Mantid::Geometry::Plane::Plane ( )

Constructor: sets plane in y-z plane and throught origin.

Definition at line 45 of file Plane.cpp.

References setBaseEqn().

Referenced by doClone().

Member Function Documentation

◆ acceptVisitor()

void Mantid::Geometry::Plane::acceptVisitor ( BaseVisit A) const
inlineoverridevirtual

Accept visitor for line calculation.

Reimplemented from Mantid::Geometry::Surface.

Definition at line 54 of file Plane.h.

References Mantid::Geometry::BaseVisit::Accept().

◆ className()

std::string Mantid::Geometry::Plane::className ( ) const
inlineoverridevirtual

Effective typename.

Reimplemented from Mantid::Geometry::Surface.

Definition at line 49 of file Plane.h.

◆ clone()

std::unique_ptr< Plane > Mantid::Geometry::Plane::clone ( ) const

Makes a clone (implicit virtual copy constructor)

Returns
new(this)

Definition at line 63 of file Plane.cpp.

References doClone().

◆ crossProd()

Kernel::V3D Mantid::Geometry::Plane::crossProd ( const Plane A) const

returns normal cross product

Take the cross produce of the normals.

Parameters
A:: plane to calculate the cross product from
Returns
the Normal x A.Normal cross product

Definition at line 194 of file Plane.cpp.

References Mantid::Kernel::V3D::cross_prod().

◆ displace()

void Mantid::Geometry::Plane::displace ( const Kernel::V3D Sp)
overridevirtual

Displace the plane by Point Sp.

i.e. r+sp now on the plane

Parameters
Sp:: point value of displacement

Implements Mantid::Geometry::Surface.

Definition at line 163 of file Plane.cpp.

References Mantid::Geometry::Quadratic::displace(), m_distance, m_normVec, and Mantid::Kernel::V3D::scalar_prod().

◆ distance()

double Mantid::Geometry::Plane::distance ( const Kernel::V3D A) const
overridevirtual

distance from a point

Determine the distance of point A from the plane returns a value relative to the normal.

Parameters
A:: point to get distance from
Returns
singed distance from point

Implements Mantid::Geometry::Surface.

Definition at line 174 of file Plane.cpp.

◆ doClone()

Plane * Mantid::Geometry::Plane::doClone ( ) const
overrideprivatevirtual

Makes a clone (implicit virtual copy constructor)

Returns
new(this)

Implements Mantid::Geometry::Quadratic.

Definition at line 54 of file Plane.cpp.

References Plane().

Referenced by clone().

◆ dotProd()

double Mantid::Geometry::Plane::dotProd ( const Plane A) const

returns normal dot product

Parameters
A:: plane to calculate the normal distance from x
Returns
the Normal.A.Normal dot product

Definition at line 185 of file Plane.cpp.

◆ getBoundingBox()

void Mantid::Geometry::Plane::getBoundingBox ( double &  xmax,
double &  ymax,
double &  zmax,
double &  xmin,
double &  ymin,
double &  zmin 
)
overridevirtual

Returns the bounding box values for plane, double max is infinity and double min is -infinity A very crude way of finding the bounding box but its very fast.

Parameters
xmax:: input & output maximum value in x direction
ymax:: input & output maximum value in y direction
zmax:: input & output maximum value in z direction
xmin:: input & output minimum value in x direction
ymin:: input & output minimum value in y direction
zmin:: input & output minimum value in z direction

Implements Mantid::Geometry::Surface.

Definition at line 327 of file Plane.cpp.

References LineIntersectionWithPlane(), and side().

◆ getDistance()

double Mantid::Geometry::Plane::getDistance ( ) const
inline

Distance from origin.

Definition at line 65 of file Plane.h.

◆ getNormal()

const Kernel::V3D & Mantid::Geometry::Plane::getNormal ( ) const
inline

Normal to plane (+ve surface)

Definition at line 66 of file Plane.h.

Referenced by LineIntersectionWithPlane().

◆ LineIntersectionWithPlane()

int Mantid::Geometry::Plane::LineIntersectionWithPlane ( Kernel::V3D  startpt,
Kernel::V3D  endpt,
Kernel::V3D output 
)

Returns the point of intersection of line with the plane.

Parameters
startpt:: input start point of the line
endpt:: input end point of the line
output:: output point of intersection
Returns
The number of points of intersection

Definition at line 299 of file Plane.cpp.

References getNormal(), m_distance, m_normVec, and Mantid::Kernel::V3D::scalar_prod().

Referenced by getBoundingBox().

◆ onSurface()

bool Mantid::Geometry::Plane::onSurface ( const Kernel::V3D A) const
overridevirtual

Calcuate the side that the point is on and returns success if it is on the surface.

  • Uses getSurfaceTolerance to determine the closeness

Implements Mantid::Geometry::Surface.

Definition at line 219 of file Plane.cpp.

◆ operator=()

Plane & Mantid::Geometry::Plane::operator= ( const Plane )
protecteddelete

◆ planeType()

std::size_t Mantid::Geometry::Plane::planeType ( ) const
private

are we alined on an axis

Find if the normal vector allows it to be a special type of plane (x,y,z direction) (Assumes m_normVec is a unit vector)

Return values
1-3:: on the x,y,z axis
0:: general plane

Definition at line 239 of file Plane.cpp.

References fabs, m_normVec, and Mantid::Kernel::Tolerance.

Referenced by write().

◆ print()

void Mantid::Geometry::Plane::print ( ) const
overridevirtual

Prints out the surface info and the Plane info.

Reimplemented from Mantid::Geometry::Surface.

Definition at line 229 of file Plane.cpp.

References m_distance, m_normVec, and Mantid::Geometry::Quadratic::print().

◆ rotate()

void Mantid::Geometry::Plane::rotate ( const Kernel::Matrix< double > &  MA)
overridevirtual

Rotate the plane about the origin by MA.

Parameters
MA:: direct rotation matrix (3x3)

Implements Mantid::Geometry::Surface.

Definition at line 152 of file Plane.cpp.

References m_normVec, Mantid::Kernel::V3D::normalize(), Mantid::Geometry::Quadratic::rotate(), and Mantid::Kernel::V3D::rotate().

◆ setBaseEqn()

void Mantid::Geometry::Plane::setBaseEqn ( )
overridevirtual

set up to be eqn based

Sets the general equation for a plane.

Implements Mantid::Geometry::Quadratic.

Definition at line 257 of file Plane.cpp.

References Mantid::Geometry::Quadratic::BaseEqn, m_distance, and m_normVec.

Referenced by Plane(), setPlane(), and setSurface().

◆ setPlane()

int Mantid::Geometry::Plane::setPlane ( const Kernel::V3D P,
const Kernel::V3D N 
)

Given a point and a normal direction set the plane.

Parameters
P:: Point for plane to pass thought
N:: Normal for the plane
Return values
0:: success

Definition at line 134 of file Plane.cpp.

References m_distance, m_normVec, Mantid::Kernel::normalize(), Mantid::Kernel::V3D::scalar_prod(), and setBaseEqn().

◆ setSurface()

int Mantid::Geometry::Plane::setSurface ( const std::string &  Pstr)
overridevirtual

processes a standard MCNPX plane string: There are three types :

  • (A) px Distance
  • (B) p A B C D (equation Ax+By+Cz=D)
  • (C) p V3D V3D V3D
    Parameters
    Pstr:: String to make into a plane of type p{xyz} or p
    Returns
    0 on success, -ve of failure

Implements Mantid::Geometry::Surface.

Definition at line 72 of file Plane.cpp.

References Mantid::Kernel::Strings::convert(), m_distance, m_normVec, Mantid::Kernel::V3D::normalize(), Mantid::Kernel::V3D::scalar_prod(), Mantid::Kernel::Strings::section(), setBaseEqn(), and Mantid::Kernel::Tolerance.

◆ side()

int Mantid::Geometry::Plane::side ( const Kernel::V3D A) const
overridevirtual

Calcualates the side that the point is on.

Parameters
A:: test point
Return values
+ve:: on the same side as the normal
-ve:: the opposite side
0:: A is on the plane itself (within tolerence)

Reimplemented from Mantid::Geometry::Surface.

Definition at line 204 of file Plane.cpp.

References Mantid::Kernel::Tolerance.

Referenced by getBoundingBox().

◆ write()

void Mantid::Geometry::Plane::write ( std::ostream &  OX) const
overridevirtual

Write in MCNPX form.

Object of write is to output a MCNPX plane info.

Parameters
OX:: Output stream (required for multiple std::endl)
Todo:
(Needs precision)

Reimplemented from Mantid::Geometry::Surface.

Definition at line 275 of file Plane.cpp.

References m_distance, m_normVec, Mantid::Geometry::Surface::Nprecision, planeType(), Mantid::Geometry::Surface::writeHeader(), and Mantid::Kernel::Strings::writeMCNPX().

Member Data Documentation

◆ m_distance

double Mantid::Geometry::Plane::m_distance
private

Distance from origin.

Definition at line 38 of file Plane.h.

Referenced by displace(), LineIntersectionWithPlane(), print(), setBaseEqn(), setPlane(), setSurface(), and write().

◆ m_normVec

Kernel::V3D Mantid::Geometry::Plane::m_normVec
private

Normal vector.

Definition at line 37 of file Plane.h.

Referenced by displace(), LineIntersectionWithPlane(), planeType(), print(), rotate(), setBaseEqn(), setPlane(), setSurface(), and write().


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