AGX Dynamics  2.35.0.1
QuadricDescriptor.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 #pragma once
18 
19 #include <agx/agxPhysics_export.h>
20 #include <agx/Vec3.h>
21 #include <agx/Matrix3x3.h>
22 #include <agx/Matrix4x4.h>
23 
24 #include <agxCollide/Quadric.h>
25 
26 namespace agxCollide {
27 
28  class Shape;
29 
30 
39  typedef struct AGXPHYSICS_EXPORT QuadricShapeDescriptor {
40 
41  // enum used for indexing radiuses/positions
42  enum PlaneIndex : agx::UInt8 {
43  TopPlane = 0,
44  BottomPlane = 1,
45  ClosestPlane = 2
46  };
47 
48 
50  agxCollide::Shape* ptr; //
51 
52  bool hollow; //
53 
54  agx::Real radiuses[2]; // Top and bottom radius. Same for cylinder, different for cone.
55 
56  agx::Real thickness; // Valid if shape is hollow
57 
58  agx::Real positions[2]; // Position for top- and bottom endcap for outer Quad
59 
60  agx::Real innerTopPosition; // Position for top endcap for inner Quad
61 
62 
63  agxCollide::Quadric3D outerQ; // Quadric for outside of shape.
64  agxCollide::Quadric3D innerQ; // Quadrid for inside of shape if hollow.
65 
66 
67  // Constructor.
68  QuadricShapeDescriptor();
69 
70 
71  inline agx::Real getRadius( PlaneIndex idx ) const { return radiuses[idx]; }
72  inline agx::Real getPosition( PlaneIndex idx ) const { return positions[idx]; }
73 
74  inline agx::Real getHeight() const { return std::fabs( positions[0] - positions[1] ); }
75 
76 
80  static QuadricShapeDescriptor createShapeDescriptor( agxCollide::Shape* shapePtr );
81 
82 
83  } QuadDesc;
85 
86 }
87 
#define AGXPHYSICS_EXPORT
Base class for a shape.
Definition: Shape.h:54
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
This namespace consists of a set of classes for handling geometric intersection tests including boole...
double Real
Definition: Real.h:42
uint8_t UInt8
Definition: Integer.h:38