BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
GUI::RealSpace::Layer Class Reference

Description

Particle layer: a transparent box.

Definition at line 23 of file layer.h.

Inheritance diagram for GUI::RealSpace::Layer:
[legend]
Collaboration diagram for GUI::RealSpace::Layer:
[legend]

Public Member Functions

 Layer (VectorRange)
 
void addExtrinsicRotation (Vector3D turn, Vector3D scale, Vector3D &rotate, Vector3D rotateExtrinsic, Vector3D &translate)
 
void transform (float scale, 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
 

Protected Attributes

bool isNull
 

Private Member Functions

void draw (Canvas &)
 
void releaseGeometry ()
 

Private Attributes

GeometryHandle geo
 
GeometricID::Key gky
 
QMatrix4x4 mat
 
Modelmodel
 

Constructor & Destructor Documentation

◆ Layer()

GUI::RealSpace::Layer::Layer ( VectorRange  d)

Definition at line 19 of file layer.cpp.

20  : Object(GeometricID::Key(GeometricID::BaseShape::Box))
21 {
22  transform(d.size(), Vector3D::_0, d.mid());
23 }
void transform(float scale, Vector3D rotate, Vector3D translate)
Definition: object.cpp:51
Object(GeometricID::Key)
Definition: object.cpp:36
static Vector3D const _0
Definition: def.h:46

References GUI::RealSpace::Vector3D::_0, GUI::RealSpace::VectorRange::mid(), GUI::RealSpace::VectorRange::size(), and GUI::RealSpace::Object::transform().

Here is the call graph for this function:

Member Function Documentation

◆ addExtrinsicRotation()

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

Definition at line 79 of file object.cpp.

81 {
82  mat.setToIdentity();
83  mat.rotate(EulerToQuaternion(rotateExtrinsic));
84  mat.translate(translate);
85  mat.rotate(EulerToQuaternion(rotate));
86  mat.scale(scale);
87  mat.rotate(EulerToQuaternion(turn));
88 
89  // first apply the particle's intrinsic and then extrinsic rotations
90  QQuaternion q = EulerToQuaternion(rotateExtrinsic) * EulerToQuaternion(rotate);
91  rotate = QuaternionToEuler(q);
92 
93  // translate the object to the extrinsically rotated translation vector
94  translate = EulerToQuaternion(rotateExtrinsic).rotatedVector(translate);
95 }
QMatrix4x4 mat
Definition: object.h:55

References GUI::RealSpace::Object::mat.

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

◆ draw()

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

Definition at line 102 of file object.cpp.

103 {
104  if (isNull)
105  return;
106 
107  if (!geo)
109  canvas.draw(color, mat, *geo);
110 }
GeometryHandle getGeometry(GeometricID::Key)
Definition: geometry.cpp:158
GeometricID::Key gky
Definition: object.h:51
GeometryHandle geo
Definition: object.h:52
GeometryStore & geometryStore()
Definition: geometry.cpp:176

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

Here is the call graph for this function:

◆ releaseGeometry()

void GUI::RealSpace::Object::releaseGeometry ( )
privateinherited

Definition at line 97 of file object.cpp.

98 {
99  geo.reset();
100 }

References GUI::RealSpace::Object::geo.

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

◆ transform() [1/4]

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

◆ transform() [2/4]

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

◆ transform() [3/4]

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

Definition at line 56 of file object.cpp.

57 {
58  mat.setToIdentity();
59  mat.translate(translate);
60  mat.rotate(EulerToQuaternion(rotate));
61  mat.scale(scale);
62 }

References GUI::RealSpace::Object::mat.

◆ transform() [4/4]

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

Definition at line 64 of file object.cpp.

65 {
66  // 1. turn to align with x/y/z as needed
67  // 2. scale to desired x/y/z size
68  // 3. rotate as needed by the scene
69  // 4. move to the position
70  mat.setToIdentity();
71  mat.translate(translate);
72  mat.rotate(EulerToQuaternion(rotate));
73  mat.scale(scale);
74  mat.rotate(EulerToQuaternion(turn));
75 }

References GUI::RealSpace::Object::mat.

Member Data Documentation

◆ color

QColor GUI::RealSpace::Object::color
inherited

◆ geo

GeometryHandle GUI::RealSpace::Object::geo
privateinherited

◆ gky

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

Definition at line 51 of file object.h.

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

◆ isNull

bool GUI::RealSpace::Object::isNull
protectedinherited

Definition at line 46 of file object.h.

Referenced by GUI::RealSpace::Particles::BarGauss::BarGauss(), GUI::RealSpace::Particles::BarLorentz::BarLorentz(), GUI::RealSpace::Particles::Bipyramid4::Bipyramid4(), GUI::RealSpace::Particles::Box::Box(), GUI::RealSpace::Particles::CantellatedCube::CantellatedCube(), GUI::RealSpace::Particles::Cone::Cone(), GUI::RealSpace::Particles::CosineRippleBox::CosineRippleBox(), GUI::RealSpace::Particles::CosineRippleGauss::CosineRippleGauss(), GUI::RealSpace::Particles::CosineRippleLorentz::CosineRippleLorentz(), GUI::RealSpace::Particles::Cylinder::Cylinder(), GUI::RealSpace::Particles::Dodecahedron::Dodecahedron(), GUI::RealSpace::Particles::EllipsoidalCylinder::EllipsoidalCylinder(), GUI::RealSpace::Particles::HemiEllipsoid::HemiEllipsoid(), GUI::RealSpace::Particles::HorizontalCylinder::HorizontalCylinder(), GUI::RealSpace::Particles::Icosahedron::Icosahedron(), GUI::RealSpace::Particles::PlatonicOctahedron::PlatonicOctahedron(), GUI::RealSpace::Particles::PlatonicTetrahedron::PlatonicTetrahedron(), GUI::RealSpace::Particles::Prism3::Prism3(), GUI::RealSpace::Particles::Prism6::Prism6(), GUI::RealSpace::Particles::Pyramid2::Pyramid2(), GUI::RealSpace::Particles::Pyramid3::Pyramid3(), GUI::RealSpace::Particles::Pyramid4::Pyramid4(), GUI::RealSpace::Particles::Pyramid6::Pyramid6(), GUI::RealSpace::Particles::SawtoothRippleBox::SawtoothRippleBox(), GUI::RealSpace::Particles::SawtoothRippleGauss::SawtoothRippleGauss(), GUI::RealSpace::Particles::SawtoothRippleLorentz::SawtoothRippleLorentz(), GUI::RealSpace::Particles::Sphere::Sphere(), GUI::RealSpace::Particles::Spheroid::Spheroid(), GUI::RealSpace::Particles::TruncatedCube::TruncatedCube(), GUI::RealSpace::Particles::TruncatedSphere::TruncatedSphere(), GUI::RealSpace::Particles::TruncatedSpheroid::TruncatedSpheroid(), and GUI::RealSpace::Object::draw().

◆ mat

QMatrix4x4 GUI::RealSpace::Object::mat
privateinherited

◆ model

Model* GUI::RealSpace::Object::model
privateinherited

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