1#include "TrajectoryAlignedComponent.h"
3#include "Components/Core/TransformComponent.h"
4#include "Components/Data/TrajectoryComponent.h"
6#include "Utilities/Math.h"
10#include "Foundation/Geometry/BoundingBox.hpp"
11#include "Foundation/Geometry/SampleListGenerator.hpp"
12#include "Foundation/Geometry/PathGenerator.hpp"
19void Cogs::Core::TrajectoryAlignedComponent::registerType()
31 DynamicComponent::registerDerivedType<TrajectoryAlignedComponent>().setFields(fields).setMethods(methods);
36 if (!trajectory)
return;
40 if (!trajectoryComponent)
return;
42 std::vector<float> depths;
44 SampleListGenerator::generateIndexedSamples(
47 trajectoryComponent->
indexes.data(),
48 static_cast<int>(trajectoryComponent->
indexes.size()),
51 if (!depths.size())
return;
56 glm::vec3 position[2];
57 glm::vec3 direction[2];
59 PathGenerator::generateLinearPath(depths.data(),
60 static_cast<int>(depths.size()),
61 trajectoryComponent->
indexes.data(),
63 static_cast<int>(trajectoryComponent->
indexes.size()),
69 glm::vec3 newPosition = position[0] + offset;
70 glm::quat newRotation = getRotation(glm::vec3(0, 0, -1), direction[0]) * rotation;
71 if (transformComponent->
position != newPosition || transformComponent->
rotation != newRotation) {
72 transformComponent->
position = newPosition;
73 transformComponent->
rotation = newRotation;
void setChanged()
Sets the component to the ComponentFlags::Changed state with carry.
ComponentType * getComponent() const
float depth
The depth along the trajectory to position the shape at.
glm::quat rotation
Rotation around the objects local axes.
std::shared_ptr< ComponentModel::Entity > trajectory
Target trajectory along which to align.
Field definition describing a single data member of a data structure.
Simple method definition.
Contains geometry calculations and generation.
Contains reflection support.
Data component defining a 3D trajectory, for example a Well trajectory.
std::vector< float > indexes
Positive distances along trajectory. For wells Measured Depth (MD). Set same length of indexes and po...
std::vector< glm::vec3 > positions
Trajectory positions. For wells the Z component is a measurement of True Vertical Depth (TVD)....
Represents an unique name.