52 throw std::logic_error(
"Failed to cast base component to ObjComponent");
62 throw std::runtime_error(
"ObjComponent::setShape - Cannot change the shape "
63 "of a parameterized object");
78 return (this->
getPos() == point);
89 return (this->
getPos() == point);
114 Track probeTrack(trkStart, trkDirection);
115 const int intercepts =
shape()->interceptSurface(probeTrack);
117 Track::LType::const_iterator it;
118 for (it = probeTrack.
cbegin(); it != probeTrack.
cend(); ++it) {
119 V3D in = it->entryPoint;
124 V3D out = it->exitPoint;
153 if ((scaleFactor -
V3D(1.0, 1.0, 1.0)).norm() < 1e-12)
160 return shape()->solidAngle(relativeObserver, scaleFactor);
195 std::vector<V3D> Coord_system;
204 absoluteBB.
xMin() *= scaleFactor.
X();
205 absoluteBB.
xMax() *= scaleFactor.
X();
206 absoluteBB.
yMin() *= scaleFactor.
Y();
207 absoluteBB.
yMax() *= scaleFactor.
Y();
208 absoluteBB.
zMin() *= scaleFactor.
Z();
209 absoluteBB.
zMax() *= scaleFactor.
Z();
212 .rotateBB(absoluteBB.
xMin(), absoluteBB.
yMin(), absoluteBB.
zMin(), absoluteBB.
xMax(), absoluteBB.
yMax(),
217 absoluteBB.
xMin() += localPos.
X();
218 absoluteBB.
xMax() += localPos.
X();
219 absoluteBB.
yMin() += localPos.
Y();
220 absoluteBB.
yMax() += localPos.
Y();
221 absoluteBB.
zMin() += localPos.
Z();
222 absoluteBB.
zMax() += localPos.
Z();
224 if (!Coord_system.empty()) {
225 absoluteBB.
realign(&Coord_system);
267 int result =
shape()->getPointInObject(point);
272 point *= scaleFactor;
319 if (
shape() !=
nullptr)
331 if (
shape() !=
nullptr)
340 if (this->
shape() !=
nullptr && this->
shape()->isFiniteGeometry())
A simple structure that defines an axis-aligned cuboid shaped bounding box for a geometrical object.
double xMax() const
Return the maximum value of X.
double zMin() const
Return the minimum value of Z.
std::vector< Kernel::V3D > const & getCoordSystem() const
returns the coordinate system to which BB is alighned to;
bool isNull() const
Is this a default constructed box?
double zMax() const
Return the maximum value of Z.
double yMax() const
Return the maximum value of Y.
bool isAxisAligned() const
Check if it is normal axis aligned bounding box or not.
double xMin() const
Return the minimum value of X.
void nullify()
set BB in to undefined state with min=FLT_MAX>max=-FLT_MAX
double yMin() const
Return the minimum value of Y.
void realign(std::vector< Kernel::V3D > const *const pCS=nullptr)
reallign the BB according to new coordinate system, provided earlier or specified as parameter;
BoundingBox boundingBox(const size_t componentIndex, const BoundingBox *reference=nullptr, const bool excludeMonitors=false) const
Compute the bounding box for the component with componentIndex taking into account all sub components...
double solidAngle(const size_t componentIndex, const Kernel::V3D &observer) const
ComponentVisitor : Visitor for IComponents.
virtual size_t registerGenericObjComponent(const IObjComponent &objComponent)=0
virtual size_t registerInfiniteObjComponent(const IObjComponent &component)=0
Component is a wrapper for a Component which can modify some of its parameters, e....
const ParameterMap * m_map
A pointer to const ParameterMap containing the parameters.
size_t index() const
Helper for legacy access mode. Returns the index of the component.
bool hasComponentInfo() const
const IComponent * base() const
Returns the address of the base component.
Kernel::V3D getScaleFactor() const override
Returns the ScaleFactor.
Kernel::V3D getPos() const override
Get the position of the IComponent. Tree structure is traverse through the.
const Component * m_base
The base component - this is the unmodified component (without the parameters).
Kernel::Quat getRotation() const override
Get the absolute orientation of the IComponent.
void render() const
Render Object or ObjComponent.
void initialize() const
Prepare/Initialize Object/ObjComponent to be rendered.
base class for Geometric IComponent
Object Component class, this class brings together the physical attributes of the component to the po...
GeometryHandler * Handle() const
Gets the GeometryHandler.
Object Component class, this class brings together the physical attributes of the component to the po...
int interceptSurface(Track &track) const override
Checks whether the track given will pass through this Component.
ObjComponent(const IComponent *base, const ParameterMap *map)
Constructor for parametrized component.
void drawObject() const override
Draws the Object.
double solidAngle(const Kernel::V3D &observer) const override
Finds the approximate solid angle covered by the component when viewed from the point given.
bool isValid(const Kernel::V3D &point) const override
Does the point given lie within this object component?
int getPointInObject(Kernel::V3D &point) const override
Try to find a point that lies within (or on) the object.
std::shared_ptr< const IObject > m_shape
The physical geometry representation.
void draw() const override
Draws the objcomponent, If the handler is not set then this function does nothing.
void getBoundingBox(BoundingBox &absoluteBB) const override
get bounding box, which may or may not be axis aligned;
const std::shared_ptr< const IObject > shape() const override
Return the shape of the component.
virtual double getWidth() const
get Width (X-dimension) value for component
const Kernel::V3D factorOutComponentPosition(const Kernel::V3D &point) const
Find the point that's in the same place relative to the constituent geometrical Object if the positio...
const Kernel::V3D takeOutRotation(Kernel::V3D point) const
Rotates a point by the reverse of the component's rotation.
bool isOnSide(const Kernel::V3D &point) const override
Does the point given lie on the surface of this object component?
virtual size_t registerContents(class ComponentVisitor &componentVisitor) const override
Register the contents of this ObjComponent.
void setShape(std::shared_ptr< const IObject > newShape)
Set a new shape on the component void setShape(std::shared_ptr<const IObject> newShape);.
virtual double getHeight() const
get Height (Y-dimension) value for component
void initDraw() const override
Initializes the ObjComponent for rendering, this function should be called before rendering.
virtual double getDepth() const
get Depth (Z-dimension) value for component
const Kernel::Material material() const override
Return the material this component is made from.
const Geometry::ComponentInfo & componentInfo() const
Only for use by ExperimentInfo. Returns a reference to the ComponentInfo.
Defines a track as a start point and a direction.
const Kernel::V3D & startPoint() const
Returns the starting point.
int addLink(const Kernel::V3D &firstPoint, const Kernel::V3D &secondPoint, const double distanceAlongTrack, const IObject &obj, const ComponentID compID=nullptr)
Adds a link to the track.
const Kernel::V3D & direction() const
Returns the direction as a unit vector.
LType::const_iterator cbegin() const
Returns an interator to the start of the set of links (const version)
LType::const_iterator cend() const
Returns an interator to one-past-the-end of the set of links (const version)
Exception thrown when an attempt is made to dereference a null pointer.
A material is defined as being composed of a given element, defined as a PhysicalConstants::NeutronAt...
void inverse()
Inverse a quaternion (in the sense of rotation inversion)
void rotate(V3D &) const
Rotate a vector.
double distance(const V3D &v) const noexcept
Calculates the distance between two vectors.
constexpr double X() const noexcept
Get x.
constexpr double Y() const noexcept
Get y.
constexpr double Z() const noexcept
Get z.
std::shared_ptr< const IObject > IObject_const_sptr
Typdef for a shared pointer to a const object.