dsegment3d.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 
15 struct GEOMDLLIMPEXP DSegment3d
17 {
19 DPoint3d point[2];
20 
21 #ifdef __cplusplus
22 
23 //BEGIN_FROM_METHODS
24 
29 static DSegment3d FromOriginAndDirection
30 (
31 DPoint3dCR point0,
32 DPoint3dCR tangent
33 );
34 
36 static DSegment3d FromZero ();
37 
39 void InitZero ();
41 void InitProduct (TransformCR transform, DSegment3dCR other);
46 static DSegment3d From (DRay3dCR ray);
47 
51 static DSegment3d From
52 (
53 double x0,
54 double y0,
55 double z0,
56 double x1,
57 double y1,
58 double z1
59 );
60 
66 static DSegment3d FromFractionInterval
67 (
68 DSegment3dCR parent,
69 double startFraction,
70 double endFraction
71 );
72 
77 static DSegment3d FromFractionInterval
78 (
79 DSegment3dCR parent,
80 DSegment1dCR interval
81 );
82 
86 static DSegment3d From
87 (
88 DPoint3dCR point0,
89 DPoint3dCR point1
90 );
91 
93 static DSegment3d From (DPoint2dCR point0, DPoint2dCR point1);
94 //END_FROM_METHODS
95 
99 void Init
100 (
101 double x0,
102 double y0,
103 double z0,
104 double x1,
105 double y1,
106 double z1
107 );
108 
114 bool Init (DSegment4dCR source);
115 
119 void Init
120 (
121 DPoint3dCR point0,
122 DPoint3dCR point1
123 );
124 
129 void Init
130 (
131 DPoint2dCR point0,
132 DPoint2dCR point1
133 );
134 
139 void InitFromOriginAndDirection
140 (
141 DPoint3dCR point0,
142 DPoint3dCR tangent
143 );
144 
149 void InitFrom (DRay3dCR ray);
150 
157 void GetEndPoints
158 (
159 DPoint3dR point0,
160 DPoint3dR point1
161 ) const;
162 
167 double LengthSquared () const;
168 
169 
171 bool IsAlmostEqual (DSegment3d other, double tolerance) const;
172 
174 bool IsSinglePoint () const;
175 
177 bool IsAlmostSinglePoint () const;
178 
183 bool GetRange (DRange3dR range) const;
184 
187 DRange1d ProjectedParameterRange (DRay3dCR ray) const;
188 
195 bool ProjectPoint
196 (
197 DPoint3dR closestPoint,
198 double &closestParam,
199 DPoint3dCR point
200 ) const;
201 
208 bool ProjectPointXY
209 (
210 DPoint3dR closestPoint,
211 double &closestParam,
212 DPoint3dCR point
213 ) const;
214 
223 bool ProjectPointBounded
224 (
225 DPoint3dR closestPoint,
226 double &closestParam,
227 DPoint3dCR point,
228 bool extend0,
229 bool extend1
230 ) const;
231 
232 
240 bool ProjectPointBounded
241 (
242 DPoint3dR closestPoint,
243 double &closestParam,
244 DPoint3dCR point
245 ) const;
246 
254 bool Intersect
255 (
256 DPoint3dR intPoint,
257 double &intParam,
258 DPlane3dCR plane
259 ) const;
260 
261 
262 
272 int IntersectCircleXY
273 (
274 DPoint3dP intPoint,
275 double *pIntParam,
276 DPoint3dCR center,
277 double radius
278 ) const;
279 
284 void GetStartPoint (DPoint3dR pt) const;
285 
290 void GetEndPoint (DPoint3dR pt) const;
291 
296 void SetStartPoint (DPoint3dCR point);
297 
302 void SetEndPoint (DPoint3dCR point);
303 
308 bool FractionParameterToPoint
309 (
310 DPoint3dR point,
311 double param
312 ) const;
313 
318 DPoint3d FractionToPoint (double fraction) const;
319 
327 bool PointToFractionParameter
328 (
329 double &param,
330 DPoint3dCR point
331 ) const;
332 
338 bool FractionParameterToTangent
339 (
340 DPoint3dR point,
341 DVec3dR tangent,
342 double param
343 ) const;
344 
349 bool GetPoint
350 (
351 DPoint3dR pt,
352 int index
353 ) const;
354 
359 bool SetPoint
360 (
361 DPoint3dCR pt,
362 int index
363 );
364 
371 void InterpolateUniformArray
372 (
373 bvector<DPoint3d>&points,
374 size_t numPoints
375 ) const;
376 
380 double Length () const;
381 
389 bool FractionToLength
390 (
391 double &arcLength,
392 double fraction0,
393 double fraction1
394 ) const;
395 
404 bool LengthToFraction
405 (
406 double &fraction1,
407 double fraction0,
408 double arcStep
409 ) const;
410 
417 bool ClosestPointBoundedXY
418 (
419 DPoint3dR closePoint,
420 double& closeParam,
421 double& distanceXY,
422 DPoint3dCR spacePoint,
423 DMatrix4dCP worldToLocal
424 ) const;
425 
434 bool ClosestPointBoundedXY
435 (
436 DPoint3dR closePoint,
437 double& closeParam,
438 double& distanceXY,
439 DPoint3dCR spacePoint,
440 DMatrix4dCP worldToLocal,
441 bool extend0,
442 bool extend1
443 ) const;
444 
445 
452 void WireCentroid
453 (
454 double &length,
455 DPoint3dR centroid,
456 double fraction0 = 0.0,
457 double fraction1 = 1.0
458 ) const;
459 
470 static
471 void ClosestApproachBounded
472 (
473 double &fraction0,
474 double &fraction1,
475 DPoint3dR point0,
476 DPoint3dR point1,
477 DSegment3dCR segment0,
478 DSegment3dCR segment1
479 );
480 
492 static
493 bool ClosestApproachUnbounded
494 (
495 double &fraction0,
496 double &fraction1,
497 DPoint3dR point0,
498 DPoint3dR point1,
499 DSegment3dCR segment0,
500 DSegment3dCR segment1
501 );
502 
503 
514 static
515 void ClosestApproachBoundedXY
516 (
517 double &fraction0,
518 double &fraction1,
519 DPoint3dR point0,
520 DPoint3dR point1,
521 DSegment3dCR segment0,
522 DSegment3dCR segment1
523 );
524 
536 static bool IntersectXY
537 (
538 double &fractionA,
539 double &fractionB,
540 DPoint3dR pointA,
541 DPoint3dR pointB,
542 DSegment3dCR segmentA,
543 DSegment3dCR segmentB
544 );
545 
546 
547 
548 
549 #endif
550 };
551 
struct DSegment4d const & DSegment4dCR
Definition: msgeomstructs_typedefs.h:145
struct DVec3d & DVec3dR
Definition: msgeomstructs_typedefs.h:89
#define END_BENTLEY_GEOMETRY_NAMESPACE
Definition: Bentley.r.h:30
struct DPoint3d * DPoint3dP
Definition: msgeomstructs_typedefs.h:79
struct DSegment1d const & DSegment1dCR
Definition: msgeomstructs_typedefs.h:144
struct DRange3d & DRange3dR
Definition: msgeomstructs_typedefs.h:108
struct DPoint2d const & DPoint2dCR
Definition: msgeomstructs_typedefs.h:78
struct DPlane3d const & DPlane3dCR
Definition: msgeomstructs_typedefs.h:113
struct DPoint3d & DPoint3dR
Definition: msgeomstructs_typedefs.h:79
struct DSegment3d const & DSegment3dCR
Definition: msgeomstructs_typedefs.h:115
A 1d interval with low and high values.
Definition: DRange1d.h:41
struct DMatrix4d const * DMatrix4dCP
Definition: msgeomstructs_typedefs.h:97
struct Transform const & TransformCR
Definition: msgeomstructs_typedefs.h:134
#define BEGIN_BENTLEY_GEOMETRY_NAMESPACE
Definition: Bentley.r.h:29
Start and end points of a line segment.
Definition: dsegment3d.h:16
struct DPoint3d const & DPoint3dCR
Definition: msgeomstructs_typedefs.h:79
struct DRay3d const & DRay3dCR
Definition: msgeomstructs_typedefs.h:120

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