BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
RealSpace::Particles::BarLorentz Class Reference
Inheritance diagram for RealSpace::Particles::BarLorentz:
[legend]
Collaboration diagram for RealSpace::Particles::BarLorentz:
[legend]

Public Member Functions

 BarLorentz (float L, float W, float H)
 
void addExtrinsicRotation (Vector3D rotateExtrinsic)
 
void addExtrinsicRotation (Vector3D turn, Vector3D scale, Vector3D &rotate, Vector3D rotateExtrinsic, Vector3D &translate)
 
void addTransform (Vector3D rotate, Vector3D translate)
 
void addTranslation (Vector3D translate_)
 
void fancy (Vector3D rotate, float r)
 
void transform (float scale, Vector3D rotate, Vector3D translate)
 
void transform (Vector3D rotate, Vector3D translate)
 
void transform (Vector3D scale, QQuaternion, Vector3D translate)
 
void transform (Vector3D scale, Vector3D rotate, Vector3D translate)
 
void transform (Vector3D turn, Vector3D scale, Vector3D rotate, Vector3D translate)
 

Public Attributes

QColor color
 

Static Public Attributes

static EShape const firstKind = EShape::None
 
static EShape const lastKind = EShape::AnisoPyramid
 

Protected Member Functions

void set ()
 

Protected Attributes

bool isNull
 
Vector3D offset
 
Vector3D rotate
 
Vector3D scale
 
Vector3D translate
 
Vector3D turn
 

Private Member Functions

void draw (Canvas &)
 
void releaseGeometry ()
 

Private Attributes

GeometryHandle geo
 
GeometricID::Key gky
 
QMatrix4x4 mat
 
Modelmodel
 

Detailed Description

Definition at line 174 of file particles.h.

Constructor & Destructor Documentation

◆ BarLorentz()

RealSpace::Particles::BarLorentz::BarLorentz ( float  L,
float  W,
float  H 
)

Definition at line 124 of file particles.cpp.

124  : Particle(Key(BaseShape::Column, 1.0f, 4))
125 {
126  isNull = (L < 0 || W < 0 || H < 0) || (L <= 0 && W <= 0 && H <= 0);
127  turn = Vector3D(0, 0, 45 * pi / 180.0f);
128  scale = Vector3D(L * sqrt2f, W * sqrt2f, H);
129  offset = Vector3D(0, 0, 0);
130  set();
131 }
Particle(GeometricID::Key)
Definition: particles.cpp:61
static float const pi
Definition: particles.cpp:97
static float const sqrt2f
Definition: particles.cpp:99

References RealSpace::GeometricID::Column, RealSpace::Object::isNull, RealSpace::Particles::Particle::offset, RealSpace::Particles::pi, RealSpace::Particles::Particle::scale, RealSpace::Particles::Particle::set(), RealSpace::Particles::sqrt2f, and RealSpace::Particles::Particle::turn.

Here is the call graph for this function:

Member Function Documentation

◆ addExtrinsicRotation() [1/2]

void Particle::addExtrinsicRotation ( Vector3D  rotateExtrinsic)
inherited

Definition at line 89 of file particles.cpp.

90 {
91  Object::addExtrinsicRotation(turn, scale, rotate, rotateExtrinsic,
92  (translate = offset + translate));
93 }
void addExtrinsicRotation(Vector3D turn, Vector3D scale, Vector3D &rotate, Vector3D rotateExtrinsic, Vector3D &translate)
Definition: object.cpp:73

References RealSpace::Object::addExtrinsicRotation(), RealSpace::Particles::Particle::offset, RealSpace::Particles::Particle::rotate, RealSpace::Particles::Particle::scale, RealSpace::Particles::Particle::translate, and RealSpace::Particles::Particle::turn.

Here is the call graph for this function:

◆ addExtrinsicRotation() [2/2]

void RealSpace::Object::addExtrinsicRotation ( Vector3D  turn,
Vector3D  scale,
Vector3D rotate,
Vector3D  rotateExtrinsic,
Vector3D translate 
)
inherited

Definition at line 73 of file object.cpp.

75 {
76  mat.setToIdentity();
77  mat.rotate(EulerToQuaternion(rotateExtrinsic));
78  mat.translate(translate);
79  mat.rotate(EulerToQuaternion(rotate));
80  mat.scale(scale);
81  mat.rotate(EulerToQuaternion(turn));
82 
83  // first apply the particle's intrinsic and then extrinsic rotations
84  QQuaternion q = EulerToQuaternion(rotateExtrinsic) * EulerToQuaternion(rotate);
85  rotate = QuaternionToEuler(q);
86 
87  // translate the object to the extrinsically rotated translation vector
88  translate = EulerToQuaternion(rotateExtrinsic).rotatedVector(translate);
89 }
QMatrix4x4 mat
Definition: object.h:54

References RealSpace::Object::mat.

Referenced by RealSpace::Particles::Particle::addExtrinsicRotation().

◆ addTransform()

void Particle::addTransform ( Vector3D  rotate,
Vector3D  translate 
)
inherited

Definition at line 78 of file particles.cpp.

79 {
80  Object::transform(turn, scale, (rotate = rotate + rotate_),
81  offset + (translate = translate + translate_));
82 }
void transform(float scale, Vector3D rotate, Vector3D translate)
Definition: object.cpp:45

References RealSpace::Particles::Particle::offset, RealSpace::Particles::Particle::rotate, RealSpace::Particles::Particle::scale, RealSpace::Object::transform(), RealSpace::Particles::Particle::translate, and RealSpace::Particles::Particle::turn.

Referenced by RealSpaceBuilderUtils::applyParticleTransformations().

Here is the call graph for this function:

◆ addTranslation()

void Particle::addTranslation ( Vector3D  translate_)
inherited

Definition at line 84 of file particles.cpp.

85 {
87 }

References RealSpace::Particles::Particle::offset, RealSpace::Particles::Particle::rotate, RealSpace::Particles::Particle::scale, RealSpace::Object::transform(), RealSpace::Particles::Particle::translate, and RealSpace::Particles::Particle::turn.

Here is the call graph for this function:

◆ draw()

void RealSpace::Object::draw ( Canvas canvas)
privateinherited

Definition at line 96 of file object.cpp.

97 {
98  if (isNull)
99  return;
100 
101  if (!geo)
103  canvas.draw(color, mat, *geo);
104 }
GeometryHandle getGeometry(GeometricID::Key)
Definition: geometry.cpp:148
GeometryHandle geo
Definition: object.h:51
GeometricID::Key gky
Definition: object.h:50
QColor color
Definition: object.h:34
GeometryStore & geometryStore()
Definition: geometry.cpp:166

References RealSpace::Object::color, RealSpace::Canvas::draw(), RealSpace::Object::geo, RealSpace::geometryStore(), RealSpace::GeometryStore::getGeometry(), RealSpace::Object::gky, RealSpace::Object::isNull, and RealSpace::Object::mat.

Here is the call graph for this function:

◆ fancy()

void Particle::fancy ( Vector3D  rotate,
float  r 
)
inherited

Definition at line 73 of file particles.cpp.

74 {
76 }

References RealSpace::Particles::Particle::offset, RealSpace::Particles::Particle::rotate, RealSpace::Particles::Particle::scale, RealSpace::Object::transform(), RealSpace::Particles::Particle::translate, and RealSpace::Particles::Particle::turn.

Here is the call graph for this function:

◆ releaseGeometry()

void RealSpace::Object::releaseGeometry ( )
privateinherited

Definition at line 91 of file object.cpp.

92 {
93  geo.reset();
94 }

References RealSpace::Object::geo.

Referenced by RealSpace::Object::~Object(), and RealSpace::Model::rem().

◆ set()

void Particle::set ( )
protectedinherited

Definition at line 63 of file particles.cpp.

64 {
66 }
void transform(Vector3D rotate, Vector3D translate)
Definition: particles.cpp:68
static Vector3D const _0
Definition: def.h:49

References RealSpace::Vector3D::_0, and RealSpace::Particles::Particle::transform().

Referenced by RealSpace::Particles::AnisoPyramid::AnisoPyramid(), RealSpace::Particles::BarGauss::BarGauss(), BarLorentz(), RealSpace::Particles::Box::Box(), RealSpace::Particles::Cone::Cone(), RealSpace::Particles::Cone6::Cone6(), RealSpace::Particles::CosineRippleBox::CosineRippleBox(), RealSpace::Particles::CosineRippleGauss::CosineRippleGauss(), RealSpace::Particles::CosineRippleLorentz::CosineRippleLorentz(), RealSpace::Particles::Cuboctahedron::Cuboctahedron(), RealSpace::Particles::Cylinder::Cylinder(), RealSpace::Particles::Dodecahedron::Dodecahedron(), RealSpace::Particles::Dot::Dot(), RealSpace::Particles::EllipsoidalCylinder::EllipsoidalCylinder(), RealSpace::Particles::FullSphere::FullSphere(), RealSpace::Particles::FullSpheroid::FullSpheroid(), RealSpace::Particles::HemiEllipsoid::HemiEllipsoid(), RealSpace::Particles::Icosahedron::Icosahedron(), RealSpace::Particles::Prism3::Prism3(), RealSpace::Particles::Prism6::Prism6(), RealSpace::Particles::Pyramid::Pyramid(), RealSpace::Particles::SawtoothRippleBox::SawtoothRippleBox(), RealSpace::Particles::SawtoothRippleGauss::SawtoothRippleGauss(), RealSpace::Particles::SawtoothRippleLorentz::SawtoothRippleLorentz(), RealSpace::Particles::Tetrahedron::Tetrahedron(), RealSpace::Particles::TruncatedCube::TruncatedCube(), RealSpace::Particles::TruncatedSphere::TruncatedSphere(), and RealSpace::Particles::TruncatedSpheroid::TruncatedSpheroid().

Here is the call graph for this function:

◆ transform() [1/5]

void RealSpace::Object::transform ( float  scale,
Vector3D  rotate,
Vector3D  translate 
)
inherited

◆ transform() [2/5]

void Particle::transform ( Vector3D  rotate,
Vector3D  translate 
)
inherited

Definition at line 68 of file particles.cpp.

69 {
70  Object::transform(turn, scale, (rotate = rotate_), offset + (translate = translate_));
71 }

References RealSpace::Particles::Particle::offset, RealSpace::Particles::Particle::rotate, RealSpace::Particles::Particle::scale, RealSpace::Object::transform(), RealSpace::Particles::Particle::translate, and RealSpace::Particles::Particle::turn.

Referenced by RealSpaceBuilderUtils::applyParticleCoreShellTransformations(), and RealSpace::Particles::Particle::set().

Here is the call graph for this function:

◆ transform() [3/5]

void RealSpace::Object::transform ( Vector3D  scale,
QQuaternion  ,
Vector3D  translate 
)
inherited

◆ transform() [4/5]

void RealSpace::Object::transform ( Vector3D  scale,
Vector3D  rotate,
Vector3D  translate 
)
inherited

Definition at line 50 of file object.cpp.

51 {
52  mat.setToIdentity();
53  mat.translate(translate);
54  mat.rotate(EulerToQuaternion(rotate));
55  mat.scale(scale);
56 }

References RealSpace::Object::mat.

◆ transform() [5/5]

void RealSpace::Object::transform ( Vector3D  turn,
Vector3D  scale,
Vector3D  rotate,
Vector3D  translate 
)
inherited

Definition at line 58 of file object.cpp.

59 {
60  // 1. turn to align with x/y/z as needed
61  // 2. scale to desired x/y/z size
62  // 3. rotate as needed by the scene
63  // 4. move to the position
64  mat.setToIdentity();
65  mat.translate(translate);
66  mat.rotate(EulerToQuaternion(rotate));
67  mat.scale(scale);
68  mat.rotate(EulerToQuaternion(turn));
69 }

References RealSpace::Object::mat.

Member Data Documentation

◆ color

QColor RealSpace::Object::color
inherited

Definition at line 34 of file object.h.

Referenced by RealSpaceBuilderUtils::applyParticleColor(), and RealSpace::Object::draw().

◆ firstKind

EShape const RealSpace::Particles::Particle::firstKind = EShape::None
staticinherited

Definition at line 70 of file particles.h.

◆ geo

GeometryHandle RealSpace::Object::geo
privateinherited

Definition at line 51 of file object.h.

Referenced by RealSpace::Object::draw(), and RealSpace::Object::releaseGeometry().

◆ gky

GeometricID::Key RealSpace::Object::gky
privateinherited

Definition at line 50 of file object.h.

Referenced by RealSpace::Object::draw().

◆ isNull

bool RealSpace::Object::isNull
protectedinherited

◆ lastKind

EShape const RealSpace::Particles::Particle::lastKind = EShape::AnisoPyramid
staticinherited

Definition at line 71 of file particles.h.

◆ mat

QMatrix4x4 RealSpace::Object::mat
privateinherited

◆ model

Model* RealSpace::Object::model
privateinherited

◆ offset

Vector3D RealSpace::Particles::Particle::offset
protectedinherited

Definition at line 64 of file particles.h.

Referenced by RealSpace::Particles::AnisoPyramid::AnisoPyramid(), RealSpace::Particles::BarGauss::BarGauss(), BarLorentz(), RealSpace::Particles::Box::Box(), RealSpace::Particles::Cone::Cone(), RealSpace::Particles::Cone6::Cone6(), RealSpace::Particles::CosineRippleBox::CosineRippleBox(), RealSpace::Particles::CosineRippleGauss::CosineRippleGauss(), RealSpace::Particles::CosineRippleLorentz::CosineRippleLorentz(), RealSpace::Particles::Cuboctahedron::Cuboctahedron(), RealSpace::Particles::Cylinder::Cylinder(), RealSpace::Particles::Dodecahedron::Dodecahedron(), RealSpace::Particles::Dot::Dot(), RealSpace::Particles::EllipsoidalCylinder::EllipsoidalCylinder(), RealSpace::Particles::FullSphere::FullSphere(), RealSpace::Particles::FullSpheroid::FullSpheroid(), RealSpace::Particles::HemiEllipsoid::HemiEllipsoid(), RealSpace::Particles::Icosahedron::Icosahedron(), RealSpace::Particles::Prism3::Prism3(), RealSpace::Particles::Prism6::Prism6(), RealSpace::Particles::Pyramid::Pyramid(), RealSpace::Particles::SawtoothRippleBox::SawtoothRippleBox(), RealSpace::Particles::SawtoothRippleGauss::SawtoothRippleGauss(), RealSpace::Particles::SawtoothRippleLorentz::SawtoothRippleLorentz(), RealSpace::Particles::Tetrahedron::Tetrahedron(), RealSpace::Particles::TruncatedCube::TruncatedCube(), RealSpace::Particles::TruncatedSphere::TruncatedSphere(), RealSpace::Particles::TruncatedSpheroid::TruncatedSpheroid(), RealSpace::Particles::Particle::addExtrinsicRotation(), RealSpace::Particles::Particle::addTransform(), RealSpace::Particles::Particle::addTranslation(), RealSpace::Particles::Particle::fancy(), and RealSpace::Particles::Particle::transform().

◆ rotate

◆ scale

Vector3D RealSpace::Particles::Particle::scale
protectedinherited

Definition at line 63 of file particles.h.

Referenced by RealSpace::Particles::AnisoPyramid::AnisoPyramid(), RealSpace::Particles::BarGauss::BarGauss(), BarLorentz(), RealSpace::Particles::Box::Box(), RealSpace::Particles::Cone::Cone(), RealSpace::Particles::Cone6::Cone6(), RealSpace::Particles::CosineRippleBox::CosineRippleBox(), RealSpace::Particles::CosineRippleGauss::CosineRippleGauss(), RealSpace::Particles::CosineRippleLorentz::CosineRippleLorentz(), RealSpace::Particles::Cuboctahedron::Cuboctahedron(), RealSpace::Particles::Cylinder::Cylinder(), RealSpace::Particles::Dodecahedron::Dodecahedron(), RealSpace::Particles::Dot::Dot(), RealSpace::Particles::EllipsoidalCylinder::EllipsoidalCylinder(), RealSpace::Particles::FullSphere::FullSphere(), RealSpace::Particles::FullSpheroid::FullSpheroid(), RealSpace::Particles::HemiEllipsoid::HemiEllipsoid(), RealSpace::Particles::Icosahedron::Icosahedron(), RealSpace::Particles::Prism3::Prism3(), RealSpace::Particles::Prism6::Prism6(), RealSpace::Particles::Pyramid::Pyramid(), RealSpace::Particles::SawtoothRippleBox::SawtoothRippleBox(), RealSpace::Particles::SawtoothRippleGauss::SawtoothRippleGauss(), RealSpace::Particles::SawtoothRippleLorentz::SawtoothRippleLorentz(), RealSpace::Particles::Tetrahedron::Tetrahedron(), RealSpace::Particles::TruncatedCube::TruncatedCube(), RealSpace::Particles::TruncatedSphere::TruncatedSphere(), RealSpace::Particles::TruncatedSpheroid::TruncatedSpheroid(), RealSpace::Particles::Particle::addExtrinsicRotation(), RealSpace::Particles::Particle::addTransform(), RealSpace::Particles::Particle::addTranslation(), RealSpace::Particles::Particle::fancy(), and RealSpace::Particles::Particle::transform().

◆ translate

◆ turn


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