CFx SDK Documentation  2023 SP0
FMGeometry.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2015, 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-2015 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 __FMGEOMETRY_H__
25 #define __FMGEOMETRY_H__
26 
27 #include <OdaCommon.h>
28 #include "FMBuildSettings.h"
29 #include "FMSTLHelper.h"
30 #include <Ge/GeTol.h>
31 #include <Ge/GePlane.h>
32 #include <Ge/GeMatrix2d.h>
33 #include <Ge/GeLine2d.h>
34 
35 #define FMGE_ANGLE_TO_MINUSPI_PI(x) ( (x>OdaPI)?(x-Oda2PI):(x) )
36 
40 namespace FacetModeler
41 {
42  struct FMGEOMETRY_API DeviationParams
43  {
45  DeviationParams( double deviation, OdUInt16 maxpercircle, OdUInt16 minpercircle );
46 
47  double Deviation;
50  };
51 
56  {
57  eUnion = 0,
60  eXOR = 3,
65  eCustom = 8,
68 
69  eclone = 100,
91  };
92 
97  {
98  eNo = 0,
99  eOn = 1,
100  eInner = 2,
101  eOuter = 3,
102  eSpanning = 4
103  };
104 
113  {
114  efoDefault = 0x00,
115  efoTop = 0x01,
116  efoBottom = 0x02,
117  efoLeft = 0x04,
118  efoRight = 0x08,
119  efoFront = 0x10,
120  efoBack = 0x20,
121  efoDiscard = 0x80
122  };
123 
125  // Substitute for Teigha for .dwg files analog.
126  FMGEOMETRY_API bool isCoplanar( const OdGePlane& plane1, const OdGePlane& plane2 );
127 
128 
130  // Teigha for .dwg files foreign method, should be on OdGeMatrix2d.
131  FMGEOMETRY_API void setToMirroring( OdGeMatrix2d& thisMatrix, const OdGePoint2d& mirrorPoint );
132 
134  // Teigha for .dwg files foreign method, should be on OdGeMatrix2d.
135  FMGEOMETRY_API void setToMirroring( OdGeMatrix2d& thisMatrix, const OdGeLine2d& mirrorLine );
136 
137 // {group:API Auxiliary Classes}
138 struct FMGEOMETRY_API FMGeGbl
139 {
148  FMGEOMETRY_API_STATIC static DeviationParams gDefDev;
149 
156  FMGEOMETRY_API_STATIC static OdGeTol gTol;
157 
162  FMGEOMETRY_API_STATIC static OdUInt16 GetSegmentCount( double dAngle, double dRadius,
163  const DeviationParams& devDeviation );
164 
168  static FaceOrientation PlaneOrientation( const OdGeVector3d& normal );
169 
173  FMGEOMETRY_API_STATIC static FaceOrientation
175 
176 };
177 
179  if ( normal.isParallelTo( OdGeVector3d::kXAxis ) ) {
180  return normal.x > 0. ? efoRight : efoLeft;
181  }
182  else if ( normal.isParallelTo( OdGeVector3d::kYAxis ) ) {
183  return normal.y > 0. ? efoBack : efoFront;
184  }
185  else if ( normal.isParallelTo( OdGeVector3d::kZAxis ) ) {
186  return normal.z > 0. ? efoTop : efoBottom;
187  }
188  return efoDefault;
189 }
190 
191 }
192 
193 #endif //__FMGEOMETRY_H__
unsigned short OdUInt16
Definition: GeTol.h:49
static GE_STATIC_EXPORT const OdGeVector3d kZAxis
Definition: GeVector3d.h:91
bool isParallelTo(const OdGeVector3d &vect, const OdGeTol &tol=OdGeContext::gTol) const
static GE_STATIC_EXPORT const OdGeVector3d kYAxis
Definition: GeVector3d.h:90
static GE_STATIC_EXPORT const OdGeVector3d kXAxis
Definition: GeVector3d.h:89
@ emergeCoincidentVertices
Definition: FMGeometry.h:71
@ eTemporary_Extension_byTwoProfiles
Definition: FMGeometry.h:89
@ ecutWithInfExtrusion
Definition: FMGeometry.h:86
@ eTemporary_Extension_byTwoContours
Definition: FMGeometry.h:88
@ eTemporaryExtensionByTwoContours
Definition: FMGeometry.h:66
@ eTemporary_Extension_extrusionByTrs
Definition: FMGeometry.h:90
@ ecutWithExtrusion
Definition: FMGeometry.h:85
@ eTemporaryExtensionExtrusionByTrs
Definition: FMGeometry.h:67
@ emergeCoplanarEntities
Definition: FMGeometry.h:72
FMGEOMETRY_API bool isCoplanar(const OdGePlane &plane1, const OdGePlane &plane2)
DOM.
FMGEOMETRY_API void setToMirroring(OdGeMatrix2d &thisMatrix, const OdGePoint2d &mirrorPoint)
DOM.
DeviationParams(double deviation, OdUInt16 maxpercircle, OdUInt16 minpercircle)
static FaceOrientation PlaneOrientation(const OdGeVector3d &normal)
Definition: FMGeometry.h:178
static FMGEOMETRY_API_STATIC OdUInt16 GetSegmentCount(double dAngle, double dRadius, const DeviationParams &devDeviation)
static FMGEOMETRY_API_STATIC DeviationParams gDefDev
Definition: FMGeometry.h:148
static FMGEOMETRY_API_STATIC FaceOrientation GetReversedOrientation(FaceOrientation eOri)
static FMGEOMETRY_API_STATIC OdGeTol gTol
Definition: FMGeometry.h:156