CFx SDK Documentation  2023 SP0
SiShapePlane.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 #ifndef _SiShapePlane_h_Included_
25 #define _SiShapePlane_h_Included_
26 
27 #include "Ge/GePlane.h"
28 #include "Ge/GeExtents3d.h"
29 #include "Si/SiSpatialIndex.h"
30 
31 #include "TD_PackPush.h"
32 
39 struct OdSiShapePlane : public OdSiShape {
42 
43  OdSiShapePlane( const OdGePoint3d& pointOnPlane, const OdGeVector3d& planeNormal ) {
44  m_pointOnPlane = pointOnPlane;
45  m_planeNormal = planeNormal;
46  }
47  OdSiShapePlane( const OdGePlane& plane ) {
48  m_pointOnPlane = plane.pointOnPlane();
49  m_planeNormal = plane.normal();
50  }
51  inline double signedDistanceTo( const OdGePoint3d& pt ) const {
53  }
54  bool contains( const OdGeExtents3d& , bool , const OdGeTol& ) const {
55  return false;
56  }
57  bool intersects( const OdGeExtents3d& extents, bool planar, const OdGeTol& tol ) const {
58  const OdGePoint3d& minPt = extents.minPoint();
59  double e = tol.equalPoint();
60  if( OdLess( signedDistanceTo( minPt ), 0.0, e ) ) {
61  const OdGePoint3d& maxPt = extents.maxPoint();
62  if( !OdLess( signedDistanceTo( maxPt ), 0.0, e ) ) {
63  return true;
64  }
65  OdGePoint3d pt( minPt.x, minPt.y, maxPt.z );
66  if( !OdLess( signedDistanceTo( pt ), 0.0, e ) ) {
67  return true;
68  }
69  pt.set( minPt.x, maxPt.y, minPt.z );
70  if( !OdLess( signedDistanceTo( pt ), 0.0, e ) ) {
71  return true;
72  }
73  pt.set( maxPt.x, minPt.y, minPt.z );
74  if( !OdLess( signedDistanceTo( pt ), 0.0, e ) ) {
75  return true;
76  }
77  pt.set( maxPt.x, maxPt.y, minPt.z );
78  if( !OdLess( signedDistanceTo( pt ), 0.0, e ) ) {
79  return true;
80  }
81  pt.set( maxPt.x, minPt.y, maxPt.z );
82  if( !OdLess( signedDistanceTo( pt ), 0.0, e ) ) {
83  return true;
84  }
85  pt.set( minPt.x, maxPt.y, maxPt.z );
86  if( !OdLess( signedDistanceTo( pt ), 0.0, e ) ) {
87  return true;
88  }
89  return false;
90  }
91  else if( OdGreater( signedDistanceTo( minPt ), 0.0, e ) ) {
92  const OdGePoint3d& maxPt = extents.maxPoint();
93  if( !OdGreater( signedDistanceTo( maxPt ), 0.0, e ) ) {
94  return true;
95  }
96  OdGePoint3d pt( minPt.x, minPt.y, maxPt.z );
97  if( !OdGreater( signedDistanceTo( pt ), 0.0, e ) ) {
98  return true;
99  }
100  pt.set( minPt.x, maxPt.y, minPt.z );
101  if( !OdGreater( signedDistanceTo( pt ), 0.0, e ) ) {
102  return true;
103  }
104  pt.set( maxPt.x, minPt.y, minPt.z );
105  if( !OdGreater( signedDistanceTo( pt ), 0.0, e ) ) {
106  return true;
107  }
108  pt.set( maxPt.x, maxPt.y, minPt.z );
109  if( !OdGreater( signedDistanceTo( pt ), 0.0, e ) ) {
110  return true;
111  }
112  pt.set( maxPt.x, minPt.y, maxPt.z );
113  if( !OdGreater( signedDistanceTo( pt ), 0.0, e ) ) {
114  return true;
115  }
116  pt.set( minPt.x, maxPt.y, maxPt.z );
117  if( !OdGreater( signedDistanceTo( pt ), 0.0, e ) ) {
118  return true;
119  }
120  return false;
121  }
122  return true; // point on plane
123  }
124 };
125 
126 #include "TD_PackPop.h"
127 
128 #endif
tol
Definition: DimVarDefs.h:2287
bool OdLess(double x, double y, double tol=1.e-10)
Definition: OdaDefs.h:530
bool OdGreater(double x, double y, double tol=1.e-10)
Definition: OdaDefs.h:540
const OdGePoint3d & maxPoint() const
Definition: GeExtents3d.h:259
const OdGePoint3d & minPoint() const
Definition: GeExtents3d.h:254
OdGePoint3d pointOnPlane() const
OdGeVector3d normal() const
OdGePoint3d & set(double xx, double yy, double zz)
Definition: GePoint3d.h:337
double z
Definition: GePoint3d.h:369
double y
Definition: GePoint3d.h:368
double x
Definition: GePoint3d.h:367
Definition: GeTol.h:49
double dotProduct(const OdGeVector3d &vect) const
Definition: GeVector3d.h:487
double signedDistanceTo(const OdGePoint3d &pt) const
Definition: SiShapePlane.h:51
OdSiShapePlane(const OdGePoint3d &pointOnPlane, const OdGeVector3d &planeNormal)
Definition: SiShapePlane.h:43
bool intersects(const OdGeExtents3d &extents, bool planar, const OdGeTol &tol) const
Definition: SiShapePlane.h:57
OdGeVector3d m_planeNormal
Definition: SiShapePlane.h:41
OdGePoint3d m_pointOnPlane
Definition: SiShapePlane.h:40
bool contains(const OdGeExtents3d &, bool, const OdGeTol &) const
Definition: SiShapePlane.h:54
OdSiShapePlane(const OdGePlane &plane)
Definition: SiShapePlane.h:47