AGX Dynamics  2.35.0.1
Quadric.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 
26 
27 namespace agxCollide {
28 
29 
33  class AGXPHYSICS_EXPORT Quadric
34  {
35  public:
36  virtual void printEquation() const = 0;
37 
38  virtual ~Quadric() {}
39 
40  };
41 
42 
46  class AGXPHYSICS_EXPORT Quadric2D : public Quadric
47  {
48  public:
49  Quadric2D();
50 
53  static Quadric2D circle( agx::Real radius );
54 
57  static Quadric2D empty();
58 
61  void set( agx::Real A, agx::Real B, agx::Real C, agx::Real D, agx::Real E, agx::Real F );
62 
63  agx::Real evaluate( agx::Vec2 point ) const;
64 
65  virtual void printEquation() const override;
66 
67  const agx::Matrix3x3& getMatrix() const;
68 
69  void setToCircle( agx::Real radius );
70 
71 
72  private:
73 
74  // Quadric3D accesses setMatrix.
75  friend class Quadric3D;
76 
77 
78  /*
79  Set the elemtents in the matrix
80  */
81  void setMatrix( agx::Real e00, agx::Real e01, agx::Real e02,
82  agx::Real e11, agx::Real e12,
83  agx::Real e22 );
84 
85  agx::Matrix3x3 m_A;
86  };
87 
88 
89 
93  class AGXPHYSICS_EXPORT Quadric3D : public Quadric
94  {
95 
96  public:
97  Quadric3D();
98 
99  void set( agx::Real A, agx::Real B, agx::Real C, agx::Real D, agx::Real E,
101 
102 
106  static Quadric3D cylinder( agx::Real radius );
107 
113  static Quadric3D cone( agx::Real angle );
114 
118  static Quadric3D empty();
119 
123  agx::Real evaluate( agx::Vec3 point ) const;
124 
125  virtual void printEquation() const override;
126 
127 
128  const agx::Matrix4x4& getMatrix() const;
129 
130 
131  Quadric2D projectXY() const;
132 
136  Quadric3D transform( agx::Matrix4x4 M ) const;
137 
138  private:
139 
140  agx::Matrix4x4 m_A;
141  };
142 
143 
144 }
145 
147 
#define AGXPHYSICS_EXPORT
Matrix class for affine transformations.
Definition: Matrix4x4.h:56
#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...
void AGXCORE_EXPORT transform(void *target, const Format *targetFormat, const void *source, const Format *sourceFormat, size_t numElements)
Transform data between two buffers.
double Real
Definition: Real.h:42