AGX Dynamics  2.35.0.1
ClipPlane.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, is 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/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
20 #include <osg/ClipNode>
21 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
22 #include <agx/Plane.h>
23 
24 #include <agxOSG/export.h>
25 #include <agxOSG/Node.h>
26 
27 // Forward declaration
28 namespace agx
29 {
30  class ParticleSystem;
31 }
32 
33 namespace agxOSG
34 {
37 
43  class AGXOSG_EXPORT ClipPlane : public osg::ClipNode
44  {
45  public:
49  ClipPlane( const agx::Plane& plane );
50 
54  ClipPlane( const agx::Vec3& normal, const agx::Vec3& position );
55 
60 
65  void setClipPlane( const agx::Plane& plane );
66 
71  void setPosition( const agx::Vec3& position );
72 
77  void setNormal( const agx::Vec3& normal );
78 
84 
89  void setEnable(bool enable);
90 
95 
100 
105 
109  bool getEnable() const;
110 
115 
116  private:
117  void setDataFromPlane(const agx::Plane& plane);
118 
119  private:
120  agx::Vec3 m_position;
121  agx::Vec3 m_normal;
122  osg::ref_ptr<osg::ClipPlane> m_clipPlane;
123  agx::ParticleSystem* m_system;
124  };
125 }
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGXOSG_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: agx/Vector.h:34
This class wraps the ClipPlane functionality of osg together with a clip node and a clip plane.
Definition: ClipPlane.h:44
ClipPlane(agx::Real a, agx::Real b, agx::Real c, agx::Real d)
Create clip plane from plane constants.
agx::Vec3 getPosition() const
Get the position of the clip plane.
ClipPlane(const agx::Vec3 &normal, const agx::Vec3 &position)
Create clip plane from a position and a normal.
void setClipPlane(const agx::Plane &plane)
Set clip plane from an agx plane.
ClipPlane(const agx::Plane &plane)
Create clip plane from agx::Plane.
void clipAgainstParticleSystem()
Performs the clipping of the set particle system.
void setPosition(const agx::Vec3 &position)
Set position of clip plane.
void setParticleSystemToClip(agx::ParticleSystem *system)
Set the particle system that should be clipped against the clip plane.
void setEnable(bool enable)
Set enable of the clip plane.
agx::Plane getPlane() const
Get a created agx::Plane representation of the clip plane.
void setNormal(const agx::Vec3 &normal)
Set normal of clip plane.
agx::Vec3 getNormal() const
Get the normal of the clip plane.
bool getEnable() const
Get if the clip plane is enabled.
A basic particle system that contains all the storages and buffers required for basic operation and a...
Class representing the mathematical concept of a plane, also called a half- space.
Definition: agx/Plane.h:32
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
double Real
Definition: Real.h:42