ClipPlane.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
5 | Copyright (c) 2018 Bentley Systems, Incorporated. All rights reserved.
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
9 
12 
22 
23 struct ClipPlane
24  {
25 #ifdef BENTLEYGEOMETRY_ClipPlaneCoordinatesPublic
26 public:
27 #else
28 private:
29 #endif
30  DVec3d m_normal;
33  double m_distance;
34 private:
35  uint32_t m_flags;
36 
37  enum
38  {
39  PlaneMask_Interior = 0x0001 << 0,
40  PlaneMask_Invisible = 0x0001 << 1,
41  };
42 
43 
44 public:
46  GEOMDLLIMPEXP ClipPlane ();
47 
49  GEOMDLLIMPEXP ClipPlane (DVec3dCR normal, double distance, bool invisible = false, bool interior = false);
50 
52  GEOMDLLIMPEXP ClipPlane (DVec3dCR normal, DPoint3dCR point, bool invisible = false, bool interior = false);
53 
55  GEOMDLLIMPEXP ClipPlane (DPlane3dCR plane, bool invisible = false, bool interior = false);
56 
58  GEOMDLLIMPEXP bool GetIsInterior () const;
59 
61  GEOMDLLIMPEXP bool GetIsInvisible () const;
62 
64  GEOMDLLIMPEXP bool IsVisible () const;
65 
67  GEOMDLLIMPEXP void SetInvisible (bool invisible);
68 
70  GEOMDLLIMPEXP uint32_t GetFlags () const;
71 
73  GEOMDLLIMPEXP void SetFlags(uint32_t flags);
74 
76  GEOMDLLIMPEXP void SetFlags (bool invisible, bool interior);
77 
79  GEOMDLLIMPEXP double GetDistance() const;
80 
82  GEOMDLLIMPEXP DVec3dCR GetNormal () const;
83 
85  GEOMDLLIMPEXP double EvaluatePoint (DPoint3dCR point) const;
86 
88  GEOMDLLIMPEXP double DotProduct (DVec3dCR normal) const;
89 
91  GEOMDLLIMPEXP double DotProduct (DPoint3dCR point) const;
92 
94  GEOMDLLIMPEXP bool IsPointOnOrInside (DPoint3dCR point) const;
95 
97  GEOMDLLIMPEXP bool IsPointOnOrInside (DPoint3dCR point, double tolerance) const;
98 
100  GEOMDLLIMPEXP DPlane3d GetDPlane3d () const;
101 
104  GEOMDLLIMPEXP bool BoundedSegmentHasSimpleIntersection (DPoint3dCR pointA, DPoint3dCR pointB, double &fraction) const;
105 
107  GEOMDLLIMPEXP void TransformInPlace (TransformCR transform);
108 
110  GEOMDLLIMPEXP bool GetRange (DRange3dR range, TransformCP transform) const;
111 
113  GEOMDLLIMPEXP void Negate ();
114 
118  GEOMDLLIMPEXP void ConvexPolygonClipInPlace (bvector<DPoint3d> &xyz, bvector<DPoint3d> &work) const;
119 
120  GEOMDLLIMPEXP void ConvexPolygonSplitInsideOutside
121  (
122  bvector<DPoint3d> const &xyz,
123  bvector<DPoint3d> &xyzIn,
124  bvector<DPoint3d> &xyzOut,
125  DRange1d &altitudeRange
126  ) const;
127 
128 
130  GEOMDLLIMPEXP void OffsetDistance (double distance);
131  };
132 
133 
134 
uint32_t GetFlags() const
Get flags.
bool GetIsInterior() const
Return the interior flag.
double DotProduct(DVec3dCR normal) const
Evaluate Dot Product with plane normal.
void ConvexPolygonSplitInsideOutside(bvector< DPoint3d > const &xyz, bvector< DPoint3d > &xyzIn, bvector< DPoint3d > &xyzOut, DRange1d &altitudeRange) const
DVec3dCR GetNormal() const
Return the plane normal.
#define END_BENTLEY_GEOMETRY_NAMESPACE
Definition: Bentley.r.h:30
void TransformInPlace(TransformCR transform)
Transform plane.
bool GetIsInvisible() const
Return the interior flag.
void SetFlags(uint32_t flags)
Set flags.
Origin and normal vector for a plane.
Definition: dplane3d.h:18
ClipPlane()
Default constructor – z vector, everything else zero.
struct DRange3d & DRange3dR
Definition: msgeomstructs_typedefs.h:108
struct Transform const * TransformCP
Definition: msgeomstructs_typedefs.h:134
struct DPlane3d const & DPlane3dCR
Definition: msgeomstructs_typedefs.h:113
A 1d interval with low and high values.
Definition: DRange1d.h:41
void Negate()
Flip the normal direction.
struct Transform const & TransformCR
Definition: msgeomstructs_typedefs.h:134
bool BoundedSegmentHasSimpleIntersection(DPoint3dCR pointA, DPoint3dCR pointB, double &fraction) const
Return true if the through {pointA} and {pointB} crosses the plane at a fractional coordinate between...
void ConvexPolygonClipInPlace(bvector< DPoint3d > &xyz, bvector< DPoint3d > &work) const
Clip a convex polygon.
DPlane3d GetDPlane3d() const
Return the plane as origin and normal.
double GetDistance() const
Return the plane distance.
bool IsVisible() const
Return whether cut for this flag should be displayed (!invisible && !isInterior);.
#define BEGIN_BENTLEY_GEOMETRY_NAMESPACE
Definition: Bentley.r.h:29
struct DPoint3d const & DPoint3dCR
Definition: msgeomstructs_typedefs.h:79
bool GetRange(DRange3dR range, TransformCP transform) const
GetRange.
bool IsPointOnOrInside(DPoint3dCR point) const
Return if the point is on or inside plane.
unsigned int uint32_t
Definition: Bentley.r.h:93
struct DVec3d const & DVec3dCR
Definition: msgeomstructs_typedefs.h:89
void OffsetDistance(double distance)
Apply offset to plane.
A single plane described by normal and distance from origin.
Definition: ClipPlane.h:23
void SetInvisible(bool invisible)
Get invisible.
double EvaluatePoint(DPoint3dCR point) const
Evaluate the plane equation at {point}.

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.