GOAT (Geometrical optics application tool) 0.1
Loading...
Searching...
No Matches
GOAT::raytracing::Cone Class Reference

This class represents a cone. The cone is defined by the reference point (position), the height and the radius. More...

#include <cone.h>

Inheritance diagram for GOAT::raytracing::Cone:
GOAT::raytracing::ObjectShape

Public Member Functions

void binRead (std::ifstream &os)
 binary reading from file
void binWrite (std::ofstream &os)
 binary writing to file
maths::Vector< double > calcCoM ()
 calculates center of mass (needed by setCenter2CoM () )
 Cone ()
 Cone (maths::Vector< double > Pos, double radius, double height, std::complex< double > n, double r0=1.0, const maths::Matrix< std::complex< double > > alpha=maths::CUNITY, const maths::Vector< double > &Ex=maths::ex, const maths::Vector< double > &Ey=maths::ey, const maths::Vector< double > &Ez=maths::ez)
 Constructor which defines the cone by the reference point, radius and height.
double getConeAngle ()
 Returns the cone angle.
double getHeight ()
 Returns the height of the cone.
double getRadius ()
 Returns the radius of the cone.
void initQuad ()
 calculates the circumferent cuboid (needed e.g. for the inelastic scattering calculations)
bool isInside (const maths::Vector< double > &p)
 checks if point P is inside the object
bool next (const maths::Vector< double > &p, const maths::Vector< double > &k, maths::Vector< double > &pout)
 Calculates next crossing point with ray. This method calculates the next crossing point with the entire cone.
double nextCone (const maths::Vector< double > &p, const maths::Vector< double > &k, maths::Vector< double > &pout)
 Calculates the next crossing point with the lateral surface of the cone. The method calculates the next crossing point with the lateral surface of the cone according to the algorithm described in the article: Ching-Kuang Shene, "V.1 - Computing the Intersection of a Line and a Cone" in Graphics Gems V, p. 227–231, Academic Press, 1995.
maths::Vector< double > norm (const maths::Vector< double > &P)
 surface normal at the point P
void scale (double sf)
void setConeAngle (double coneAngle)
 Set the cone angle.
void setHeight (double height)
 Set the height of the cone.
void setPos (double x, double y, double z)
 sets reference point P
void setPos (maths::Vector< double > r)
 sets reference point P
void setr0 (double r0)
 defines the radius of the calculation sphere
void setRadius (double radius)
 Set the radius of the cone.
double volume ()
 returns the volume of the object
 ~Cone ()
Public Member Functions inherited from GOAT::raytracing::ObjectShape
std::complex< double > getn ()
 returns refractive index for inelastic (RRT) calculation
std::complex< double > getninel ()
 returns refractive index
bool getVisible ()
 show the visiblity state (used in GOATvis)
bool isActive ()
 returns true if the object should be considered for inelastic calculation
bool isOutsideWorld ()
 Test if bounding box is (partly) outside the calculation space.
 ObjectShape ()
 ObjectShape (const maths::Vector< double > &P, std::complex< double > n, GOAT::maths::Matrix< std::complex< double > > alpha, const maths::Vector< double > &Ex=maths::ex, const maths::Vector< double > &Ey=maths::ey, const maths::Vector< double > &Ez=maths::ez, const int type=-1)
 Constructor, as template for all derived classes.
 ObjectShape (const ObjectShape &F)
void rotate (maths::Vector< double > A, double phi)
 sets the matrix for the transformation between object's coordinate system and outer coordinate system, A: rotation axis, phi: angle for rotation around A
void scale (double sf)
 sets scaling of the shape by the factor sf
void setActive (bool active)
 sets flag if the object is inelastic active, i.e. it will be considered for inelastic calculation
void setAlpha (double Alpha)
 sets rotation angle around x-axis
void setBeta (double Beta)
 sets rotation angle around y-axis
void setCenter (maths::Vector< double > P)
 sets Center to P (check, if function is necessary)
void setCenter2CoM ()
 Calculates the center of mass (CoM) and sets the object's reference point to the CoM.
void setGamma (double Gamma)
 sets rotation angle around z-axis
void setMatrix (double alpha, double beta, double gamma)
 sets the matrix for the transformation between object's coordinate system and outer coordinate system, alpha, beta, gamma: angles (rotation around x-, y- and z-axis) to calculate transformation matrix
void setMatrix (maths::Matrix< double > H)
 sets the matrix for the transformation between object's coordinate system and outer coordinate system, H: transformation matrix
void setn (std::complex< double > n)
 sets refractive index
void setninel (std::complex< double > ninel)
 sets refractive index for inelastic (RRT) calculation
void setPolMatrix (maths::Matrix< std::complex< double > >alpha)
 sets polarisability matrix
void setVisible (bool visible)
 set visiblity (used in GOATvis)
int Type ()
 returns the object's type

Private Member Functions

void init ()
 Initialisation of all internal variables.

Private Attributes

double coneAngle
 cone angle
double cosCA
 cosine of the cone angle
double height
 height of the cone
maths::Vector< double > normv
 normalized Vector from the tip cone to the reference point Pos
double radius
 radius of the base area
double sideLen
 length of the side of the cone
double tan2CA
 square of the tangens of the cone angle
maths::Vector< double > V
 Position of the tip of the cone.
maths::Vector< double > v
 Vector from the tip cone to the reference point Pos.

Additional Inherited Members

Public Attributes inherited from GOAT::raytracing::ObjectShape
bool Active
 should the object be considered for inelastic (RRT) calculations?
maths::Matrix< std::complex< double > > alpha
 polarisability matrix
maths::Vector< double > e [3]
 unity vectors, describing the directions of the local coordinate system
double Ealpha
double Ebeta
double Egamma
 angles through which the object was rotated (around the x- (Ealpha), then the y- (Ebeta) and finally the z-axis (Egamma))
maths::Matrix< double > H
std::complex< double > n
 refractive index of the object
std::function< std::complex< double >(double)> nfunc
NFUNCTYPE nfuncType =NFUNCTYPE::vacuum
std::complex< double > ninel
 refractive index of the object, used for inelastic (RRT) calculation
maths::Vector< double > P
 position of the object
maths::Vector< double > por
 corners of the circumferent cuboid (lower left corner and upper right corner)
maths::Vector< double > pul
maths::Matrix< double > R
 matrices for the transformation in the local coordinate system (H) and back to the calculation system (R)
double r0
 radius of the calculation sphere
double rho
 mass density in \( kg/m^3 \)
double sf =1
 scaling factor, it is used to scale the shape of the object
int type
 type of the object
bool visible =true

Detailed Description

This class represents a cone. The cone is defined by the reference point (position), the height and the radius.

Definition at line 15 of file cone.h.

Constructor & Destructor Documentation

◆ Cone() [1/2]

GOAT::raytracing::Cone::Cone ( )

◆ Cone() [2/2]

GOAT::raytracing::Cone::Cone ( maths::Vector< double > Pos,
double radius,
double height,
std::complex< double > n,
double r0 = 1.0,
const maths::Matrix< std::complex< double > > alpha = maths::CUNITY,
const maths::Vector< double > & Ex = maths::ex,
const maths::Vector< double > & Ey = maths::ey,
const maths::Vector< double > & Ez = maths::ez )

Constructor which defines the cone by the reference point, radius and height.

Parameters
PosReference point in the center of the base (acts as position of the cone)
radiusRadius of the base area
heightHeight of the cone The cone is oriented in z-direction.

◆ ~Cone()

GOAT::raytracing::Cone::~Cone ( )

Member Function Documentation

◆ binRead()

void GOAT::raytracing::Cone::binRead ( std::ifstream & os)
virtual

binary reading from file

Implements GOAT::raytracing::ObjectShape.

◆ binWrite()

void GOAT::raytracing::Cone::binWrite ( std::ofstream & os)
virtual

binary writing to file

Implements GOAT::raytracing::ObjectShape.

◆ calcCoM()

maths::Vector< double > GOAT::raytracing::Cone::calcCoM ( )
virtual

calculates center of mass (needed by setCenter2CoM () )

Implements GOAT::raytracing::ObjectShape.

◆ getConeAngle()

double GOAT::raytracing::Cone::getConeAngle ( )

Returns the cone angle.

◆ getHeight()

double GOAT::raytracing::Cone::getHeight ( )

Returns the height of the cone.

◆ getRadius()

double GOAT::raytracing::Cone::getRadius ( )

Returns the radius of the cone.

◆ init()

void GOAT::raytracing::Cone::init ( )
private

Initialisation of all internal variables.

◆ initQuad()

void GOAT::raytracing::Cone::initQuad ( )
virtual

calculates the circumferent cuboid (needed e.g. for the inelastic scattering calculations)

Implements GOAT::raytracing::ObjectShape.

◆ isInside()

bool GOAT::raytracing::Cone::isInside ( const maths::Vector< double > & p)
virtual

checks if point P is inside the object

Implements GOAT::raytracing::ObjectShape.

◆ next()

bool GOAT::raytracing::Cone::next ( const maths::Vector< double > & p,
const maths::Vector< double > & k,
maths::Vector< double > & pout )
virtual

Calculates next crossing point with ray. This method calculates the next crossing point with the entire cone.

Parameters
[in]pReference point of the ray
[in]kDirectional vector of the ray (normalized)
[out]poutcrossing point (if found)
Returns
True, if a crossing point was found

Implements GOAT::raytracing::ObjectShape.

◆ nextCone()

double GOAT::raytracing::Cone::nextCone ( const maths::Vector< double > & p,
const maths::Vector< double > & k,
maths::Vector< double > & pout )

Calculates the next crossing point with the lateral surface of the cone. The method calculates the next crossing point with the lateral surface of the cone according to the algorithm described in the article: Ching-Kuang Shene, "V.1 - Computing the Intersection of a Line and a Cone" in Graphics Gems V, p. 227–231, Academic Press, 1995.

Parameters
[in]pReference point of the ray
[in]kDirectional vector of the ray (normalized)
[out]poutcrossing point (if found)
Returns
distance of p and the crossing point if found, otherwise -1

◆ norm()

maths::Vector< double > GOAT::raytracing::Cone::norm ( const maths::Vector< double > & P)
virtual

surface normal at the point P

Implements GOAT::raytracing::ObjectShape.

◆ scale()

void GOAT::raytracing::Cone::scale ( double sf)

◆ setConeAngle()

void GOAT::raytracing::Cone::setConeAngle ( double coneAngle)

Set the cone angle.

◆ setHeight()

void GOAT::raytracing::Cone::setHeight ( double height)

Set the height of the cone.

◆ setPos() [1/2]

void GOAT::raytracing::Cone::setPos ( double x,
double y,
double z )
virtual

sets reference point P

Implements GOAT::raytracing::ObjectShape.

◆ setPos() [2/2]

void GOAT::raytracing::Cone::setPos ( maths::Vector< double > r)
virtual

sets reference point P

Implements GOAT::raytracing::ObjectShape.

◆ setr0()

void GOAT::raytracing::Cone::setr0 ( double r0)
virtual

defines the radius of the calculation sphere

Implements GOAT::raytracing::ObjectShape.

◆ setRadius()

void GOAT::raytracing::Cone::setRadius ( double radius)

Set the radius of the cone.

◆ volume()

double GOAT::raytracing::Cone::volume ( )
virtual

returns the volume of the object

Implements GOAT::raytracing::ObjectShape.

Member Data Documentation

◆ coneAngle

double GOAT::raytracing::Cone::coneAngle
private

cone angle

Definition at line 82 of file cone.h.

◆ cosCA

double GOAT::raytracing::Cone::cosCA
private

cosine of the cone angle

Definition at line 83 of file cone.h.

◆ height

double GOAT::raytracing::Cone::height
private

height of the cone

Definition at line 87 of file cone.h.

◆ normv

maths::Vector<double> GOAT::raytracing::Cone::normv
private

normalized Vector from the tip cone to the reference point Pos

Definition at line 81 of file cone.h.

◆ radius

double GOAT::raytracing::Cone::radius
private

radius of the base area

Definition at line 86 of file cone.h.

◆ sideLen

double GOAT::raytracing::Cone::sideLen
private

length of the side of the cone

Definition at line 85 of file cone.h.

◆ tan2CA

double GOAT::raytracing::Cone::tan2CA
private

square of the tangens of the cone angle

Definition at line 84 of file cone.h.

◆ V

maths::Vector<double> GOAT::raytracing::Cone::V
private

Position of the tip of the cone.

Definition at line 79 of file cone.h.

◆ v

maths::Vector<double> GOAT::raytracing::Cone::v
private

Vector from the tip cone to the reference point Pos.

Definition at line 80 of file cone.h.


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