GOAT (Geometrical optics application tool) 0.1
Loading...
Searching...
No Matches
ellipsoid.h
Go to the documentation of this file.
1#ifndef ELLIPSOID_H
2#define ELLIPSOID_H
3
4#include <complex>
5#include "vector.h"
6#include "matrix.h"
7#include "objectshape.h"
8#include <iostream>
9#include <fstream>
10
11namespace GOAT
12{
13 namespace raytracing
14 {
20 class Ellipsoid : public ObjectShape
21 {
22 public:
23 // Ellipsoid &operator = (const Ellipsoid& e);
49 std::complex<double> n,
50 double r0 = 1.0,
51 const maths::Matrix<std::complex<double> > alpha = maths::CUNITY,
52 const maths::Vector<double>& Ex = maths::ex,
53 const maths::Vector<double>& Ey = maths::ey,
54 const maths::Vector<double>& Ez = maths::ez
55 );
56 void scale(double sf);
82 double volume();
83 void initQuad();
84 friend std::ostream& operator << (std::ostream& os, Ellipsoid E);
85 void binWrite(std::ofstream& os);
86 void binRead(std::ifstream& os);
87 double a() { return r[0]; }
88 double b() { return r[1]; }
89 double c() { return r[2]; }
92 void setPos(double x, double y, double z) { setPos(maths::Vector<double>(x, y, z)); }
94 void setr(double a, double b, double c);
98 void seta(double a, bool VConst = false);
102 void setb(double b, bool VConst = false);
106 void setc(double c, bool VConst = false);
107 void setr0(double r0);
This class represents a threedimensional (numeric) Matrix as a template.
Definition matrix.h:23
Template class for threedimensional vectors.
Definition vector.h:57
double volume()
Calculates the volume of the ellipsoid.
void setr(double a, double b, double c)
Sets the lengths of the three half axis, represented by a, b and c.
maths::Vector< double > norm(const maths::Vector< double > &p)
calculates the surface normal of the ellipsoid at a certain point (p must be on the surface)
maths::Vector< double > P2
Square of the position vector P: P2=(P[0]^2,P[1]^2,P[2]^2) (for internal use only)
Definition ellipsoid.h:114
Ellipsoid(const maths::Vector< double > &P, const maths::Vector< double > &r, 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)
Main constructor for class Ellipsoid.
void setPos(double x, double y, double z)
Sets the position of the ellipsoid(center) to a vector, represented by its components x,...
Definition ellipsoid.h:92
maths::Matrix< double > computeInertia()
Calculates the inertia matrix of the ellipsoid.
bool isInside(const maths::Vector< double > &p)
Checks if a certain position is inside the object.
maths::Vector< double > getr()
Returns a vector, where its components are the lengths of the three half axis.
Definition ellipsoid.h:90
maths::Vector< double > calcCoM()
Calculates the center of mass, which is in the case of an ellipsoid simply its center,...
Definition ellipsoid.h:108
void binRead(std::ifstream &os)
Reads informatopn about an ellipsoid from a binary file.
void initQuad()
Sets the circumscribing cuboid (for use in inelastic calculations)
double c()
Returns the length of the third half axis.
Definition ellipsoid.h:89
maths::Vector< double > r
GOAT::maths::Vector, where its components represent the lengths of the corresponding half axis.
Definition ellipsoid.h:112
double b()
Returns the length of the second half axis.
Definition ellipsoid.h:88
void setr(maths::Vector< double > &r)
Sets the lengths of the three half axis, represented by the components of r.
Ellipsoid & operator=(Ellipsoid &f)
void setPos(maths::Vector< double > r)
Set the position of the ellipsoid (center) to r.
Definition ellipsoid.h:91
Ellipsoid(const ObjectShape &)
void setr0(double r0)
defines the radius of the calculation sphere
void seta(double a, bool VConst=false)
void setb(double b, bool VConst=false)
bool next(const maths::Vector< double > &Ps, const maths::Vector< double > &K, maths::Vector< double > &pout)
Calculates the next intersection point with a ray, which is represented by a reference point and the ...
void scale(double sf)
Set the scaling factor (the half axis will be multiplied by this factor)
void binWrite(std::ofstream &os)
Writes information about the ellipsoid in a binary file.
double a()
Returns the length of the first half axis.
Definition ellipsoid.h:87
friend std::ostream & operator<<(std::ostream &os, Ellipsoid E)
Ellipsoid(const Ellipsoid &E)
Copy Constructor.
maths::Vector< double > r_2
GOAT::maths::Vector, where its components represent the square of lengths of the corresponding half a...
Definition ellipsoid.h:113
void setc(double c, bool VConst=false)
double sf
scaling factor, it is used to scale the shape of the object
maths::Matrix< std::complex< double > > alpha
polarisability matrix
maths::Vector< double > P
position of the object
double r0
radius of the calculation sphere
std::complex< double > n
refractive index of the object
This file contains the definition of a template for 3x3 matrices, which can be used together with the...
const Matrix< std::complex< double > > CUNITY
Unity matrix (complex-valued)
Definition matrix.h:475
Raytracer used for ultrashort pulse calculation with raytracing only.
Definition asphericLens.h:6
This class is used for the iray class. This class is intended for internal use only....
Definition fresnel.h:7
This file contains the Vector template class and some useful functions around this class.