AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
WireNodeDensityController.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agxWire/Node.h>
20
22
23namespace agxWire
24{
25 class WireDistanceCompositeConstraint;
26
27 typedef agx::RangeReal WireNodeRange;
28
29 struct AGXPHYSICS_EXPORT HighResData
30 {
31 HighResData() : range( agx::Real( 0 ), agx::Real( 0 ) ), resolutionPerUnitLength( agx::Real( 0 ) ) {}
32
33 HighResData( agx::RangeReal rangeRelWire, agx::Real resPerUnitLength )
34 : range( rangeRelWire ), resolutionPerUnitLength( resPerUnitLength ) {}
35
36 agx::Bool overlaps( agx::RangeReal otherRange ) const
37 {
38 return agx::leq(range.lower(), otherRange.upper() ) &&
39 agx::geq(range.upper(), otherRange.lower() );
40 }
41
42 agx::Bool overlaps( agx::Real val, agx::Real epsilon )
43 {
44 return overlaps( agx::RangeReal( val - epsilon, val + epsilon ) );
45 }
46
47 HighResData reversed() const
48 {
49 HighResData ret = *this;
50 ret.range.lower() *= agx::Real( -1 );
51 ret.range.upper() *= agx::Real( -1 );
52 std::swap( ret.range.lower(), ret.range.upper() );
53 return ret;
54 }
55
56 agx::RangeReal range;
57 agx::Real resolutionPerUnitLength;
58 };
59 typedef agx::Vector< HighResData > HighResDataContainer;
60 typedef agx::List< HighResData > HighResDataList;
61
62 class AGXPHYSICS_EXPORT WireNodeDensityController : public agx::Referenced
63 {
64 public:
65 WireNodeDensityController() {}
66
67 void update( agxWire::WireDistanceCompositeConstraint* wire );
68
69 void clear();
70
76 const HighResDataContainer& getHighResolutionData() const;
77
83 HighResDataList& getRangeExcessData();
84
85 void addResolutionRange( agxWire::Node* node, agx::Real distanceAlongWire );
86 void addResolutionRange( agx::RangeReal range, agx::Real resolutionPerUnitLength );
87 void addResolutionRange( agxWire::HighResData hresData );
88
89 void addExternalHighResolutionRange( Node* node, agx::Real distanceOnSegment );
90
94 bool resolutionHighEnoughForPosition(const agx::Real restlengthToBfn,const agx::Real minDistanceToLump, const agx::Real eps = agx::Real(1E-6) ) const;
95
101 void findLocalHighResolutionRanges( const agx::Real distanceOnWireToStart, const agx::Real localLength, agx::Vector< agxWire::WireNodeRange >& foundRanges );
102
103 private:
104 HighResDataContainer m_highResolutionNodesDistanceOnWire;
105 HighResDataList m_rangeExcess;
106
107 };
108
109}
110
#define AGXPHYSICS_EXPORT
Class defining a node that is part of a wire.
T & lower()
Definition Range.h:286
T & upper()
Definition Range.h:298
Base class providing referencing counted objects.
Definition Referenced.h:120
Templated vector class.
Definition agx/Vector.h:53
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition macros.h:96
AGXTERRAIN_EXPORT void clear()
Implements a Wire model with adaptive resolution.
Definition MergedBody.h:40
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
bool Bool
Definition Integer.h:40
bool geq(double a, double b, double eps=(double) AGX_EQUIVALENT_EPSILON)
Definition Math.h:381
double Real
Definition Real.h:42
bool leq(double a, double b, double eps=(double) AGX_EQUIVALENT_EPSILON)
Definition Math.h:369
void swap(agx::Name &lhs, agx::Name &rhs)
Definition Name.h:323