AGX Dynamics  2.35.0.1
Deformable1DRoute.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGXMODEL_DEFORMABLE1DROUTE_H
18 #define AGXMODEL_DEFORMABLE1DROUTE_H
19 
21 
22 namespace agxModel
23 {
26  AGX_DECLARE_POINTER_TYPES(Deformable1DMinErrorPointRoute);
27 
33  {
34  public:
43 
47  Deformable1DInitializationReport(agx::Real targetError, agx::Real maxError, agx::Real resolution, size_t numNodes);
48 
53 
58 
63 
67  size_t getNumNodes() const;
68 
73 
80 
85 
90 
91  private:
92  agx::Real m_targetError;
93  agx::Real m_maxError;
94  agx::Real m_resolution;
95  size_t m_numNodes;
96  };
97 
102  {
103  public:
110 
112 
116  virtual void postInitialize();
117 
123 
128 
130 
131  protected:
136  Deformable1DRoute( agx::Real resolutionPerUnitLength );
137 
142 
143 
145 
151 
160 
165  void setResolutionPerUnitLength( agx::Real resolutionPerUnitLength );
166 
170  void store( agxStream::OutputArchive& out ) const override;
171 
175  void restore( agxStream::InputArchive& in ) override;
176 
177  private:
178  Deformable1DNodeRefContainer m_allNodes;
179  agx::Real m_resolutionPerUnitLength;
180  };
181 
186  {
187  public:
198  Deformable1DPointRoute( agx::Real resolutionPerUnitLength, agx::Real minError = agx::Real(-1) );
199 
200  void setMinError(agx::Real minError);
202 
209 
216 
223 
228 
229 
234 
235 
237 
238  protected:
243 
248 
249 
251 
256 
257  protected:
261  };
262 
270  {
271  public:
273  {
275 
276  RouteData( agxModel::Deformable1DNodeRef node, agx::Real length ) : node( node ), length( length ) {}
279  };
280 
281  public:
286 
294 
299 
301 
302  protected:
307 
312 
314 
315  protected:
317  };
318 }
319 
320 #endif // AGXMODEL_DEFORMABLE1DROUTE_H
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
#define AGXMODEL_EXPORT
Initialization report kept in Deformable1D object for the user to check validity of the initial state...
void store(agxStream::OutputArchive &out) const
Store to output archive.
Deformable1DInitializationReport()
Create a report with values indication that no initialization has happened yet, or that the initializ...
void restore(agxStream::InputArchive &in)
Restore from input archive.
Deformable1DInitializationReport(agx::Real targetError, agx::Real maxError, agx::Real resolution, size_t numNodes)
Construct given target (minimum) error and the actual (maximum) error from route.
Route the initial setup given nodes.
Deformable1DNodeRoute()
Default constructor.
virtual ~Deformable1DNodeRoute()
Default constructor for serialization.
agxModel::Deformable1DNodeRef add(agxModel::Deformable1DNodeRef node, agx::Real length)
Add node to route.
virtual agxModel::Deformable1DInitializationReport tryInitializeAllNodes() override
virtual agxModel::Deformable1DInitializationReport initializeAndAddAllNodes() override
Initializes.
const RouteData::Container & getRouteDataContainer() const
Routing implementation where the user add 'points', i.e., orientation is neglected.
virtual agxModel::Deformable1DInitializationReport tryInitializeAllNodes() override
agx::Real getOriginalResolutionPerUnitLength() const
Deformable1DPointRoute(agx::Real resolutionPerUnitLength, agx::Real minError=agx::Real(-1))
Construct given wanted resolution per unit length and minimum wanted error from routing.
Deformable1DNodeRefContainer m_routeNodes
Deformable1DPointRoute()
Default constructor for serialization.
virtual agxModel::Deformable1DInitializationReport initializeAndAddAllNodes() override
Initialize call from base.
void setMinError(agx::Real minError)
const agxModel::Deformable1DNodeRefContainer & getRouteNodes() const
agx::Bool add(agxModel::Deformable1DNodeRef node)
Add node to the route.
agxModel::Deformable1DNodeRef add(agxModel::NodeAttachmentRef attachment)
Add attachment to the route.
virtual ~Deformable1DPointRoute()
Reference counted object, protected destructor.
agxModel::Deformable1DNodeRef add(const agx::Vec3 &point)
Add free world point to the route.
Base class for routing algorithms holding all nodes and resolution.
virtual agxModel::Deformable1DInitializationReport tryInitializeAllNodes()=0
void restore(agxStream::InputArchive &in) override
Restore given input archive.
virtual ~Deformable1DRoute()
Reference counted object, protected destructor.
virtual void postInitialize()
Called after the Deformable1D has been successfully initialized.
void setResolutionPerUnitLength(agx::Real resolutionPerUnitLength)
Possibility for implementations to change the resolution.
agx::Real getResolutionPerUnitLength() const
void store(agxStream::OutputArchive &out) const override
Store given output archive.
agx::Bool add(agxModel::Deformable1DNodeRef node, agx::Real length)
Add-node-method for implementations.
virtual agxModel::Deformable1DInitializationReport initializeAndAddAllNodes()=0
Pure virtual method where the implementation should execute its routing algorithm and add the nodes f...
agxModel::Deformable1DInitializationReport tryInitialize()
AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(agxModel::Deformable1DRoute)
Deformable1DRoute(agx::Real resolutionPerUnitLength)
Construct given resolution per unit length.
agxModel::Deformable1DInitializationReport initialize()
Initialize call from the Deformable1D implementation expecting a report how the routing went.
const agxModel::Deformable1DNodeRefContainer & getNodes() const
All nodes from routing - these nodes are only kept during initialization stage.
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:52
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:57
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:45
Base class providing referencing counted objects.
Definition: Referenced.h:114
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition: FlowUnit.h:37
InputRef< T > in(const char *name, T &obj)
Create an object with a name and a reference to the object that should be restored (usually a pointer...
Definition: InputArchive.h:400
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive.
bool Bool
Definition: Integer.h:48
double Real
Definition: Real.h:42
RouteData(agxModel::Deformable1DNodeRef node, agx::Real length)