BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
RealSpace::Layer Class Reference
Inheritance diagram for RealSpace::Layer:
[legend]
Collaboration diagram for 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
 

Detailed Description

Definition at line 23 of file layer.h.

Constructor & Destructor Documentation

◆ Layer()

Layer::Layer ( VectorRange  d)

Definition at line 19 of file layer.cpp.

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

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

Here is the call graph for this function:

Member Function Documentation

◆ addExtrinsicRotation()

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().

◆ 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:

◆ 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().

◆ transform() [1/4]

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

◆ transform() [2/4]

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

◆ transform() [3/4]

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() [4/4]

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().

◆ 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

◆ mat

QMatrix4x4 RealSpace::Object::mat
privateinherited

◆ model

Model* RealSpace::Object::model
privateinherited

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