dpoint2d.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 
11 #ifndef dpoint2d_H_
12 #define dpoint2d_H_
13 
23 struct GEOMDLLIMPEXP DPoint2d
24 {
26 double x;
28 double y;
29 
30 #ifdef __cplusplus
31 
32 
33 
37 static DPoint2d From (double ax, double ay);
39 static DPoint2d FromZero();
41 static DPoint2d FromOne();
45 void Init (double x, double y);
46 
49 static DPoint2d From (DPoint3dCR source);
50 
52 void Zero ();
54 void One ();
55 
57 void Init (DPoint3dCR source);
59 void InitDisconnect ();
60 
61 
62 
63 
64 
68 void SumOf (DPoint2dCR point1, DPoint2dCR point2);
71 void Add (DPoint2dCR vector);
72 
75 void Subtract (DPoint2dCR vector);
76 
80 void DifferenceOf (DPoint2dCR point1, DPoint2dCR point2);
81 
86 double NormalizedDifferenceOf (DPoint2dCR point1, DPoint2dCR point2);
87 
88 
92 static DPoint2d FromScale (DPoint2d point, double scale);
97 void Scale (DPoint2dCR source, double s);
98 
101 void Scale (double s);
102 
105 void Negate (DPoint2dCR vector);
106 
115 double ScaleToLength (DPoint2dCR source, double length);
116 
126 double ScaleToLength (double length);
127 
130 double Normalize ();
133 double Normalize (DPoint2dCR vector1);
134 
140 static DPoint2d FromSumOf (DPoint2dCR point0, double scale0, DPoint2dCR point1, double scale1);
141 
142 
150 static DPoint2d FromSumOf (DPoint2dCR point0, double scale0, DPoint2dCR point1, double scale1, DPoint2dCR point2, double scale2);
161 void SumOf (DPoint2dCR vector1, double scale1, DPoint2dCR vector2, double scale2, DPoint2dCR vector3, double scale3);
162 
163 
168 static DPoint2d FromSumOf (DPoint2dCR origin, DVec2dCR vector, double scaleFactor);
169 
174 void SumOf (DPoint2dCR point, DPoint2dCR vector, double s);
175 
176 
183 static DPoint2d FromSumOf (DPoint2dCR origin, DVec2dCR vector0, double scaleFactor0, DVec2dCR vector1, double scaleFactor1);
184 
194 void SumOf (DPoint2dCR origin, DPoint2dCR vector1, double scale1, DPoint2dCR vector2, double scale2);
195 
204 static DPoint2d FromSumOf (DPoint2dCR origin, DVec2dCR vector0, double scaleFactor0, DVec2dCR vector1, double scaleFactor1, DVec2dCR vector2, double scaleFactor2);
205 
206 
218 void SumOf (DPoint2dCR origin, DPoint2dCR vector1, double scale1, DPoint2dCR vector2, double scale2, DPoint2dCR vector3, double scale3);
219 
220 
221 
226 static DPoint2d FromInterpolate (DPoint2dCR point0, double fraction, DPoint2dCR point1);
227 
233 void Interpolate (DPoint2dCR point0, double s, DPoint2dCR point1);
234 
235 
243 static DPoint2d FromInterpolateBilinear (DPoint2dCR point00, DPoint2dCR point10, DPoint2dCR point01, DPoint2dCR point11, double u, double v);
244 
245 
247 void Rotate90 (DPoint2dCR vec);
251 void RotateCCW (DPoint2dCR vec, double radians);
252 
253 
256 void Swap (DPoint2dR other);
257 
258 
259 
260 
263 double Magnitude () const;
265 double MagnitudeSquared () const;
266 
270 double Distance (DPoint2dCR point1) const;
276 double DistanceSquared (DPoint2dCR point2) const;
277 
280 double CrossProduct (DPoint2dCR vector1) const;
281 
286 double CrossProductToPoints
287 (
288 DPoint2dCR target1,
289 DPoint2dCR target2
290 ) const;
291 
295 double DotProduct (DPoint2dCR vector2) const;
296 
303 double DotProductToPoints
304 (
305 DPoint2dCR target1,
306 DPoint2dCR target2
307 ) const;
308 
309 
310 
315 void SetComponent (double a, int index);
316 
320 double GetComponent (int index) const;
323 void GetComponents (double &xCoord, double &yCoord) const;
324 
325 
328 void InitFromArray
329 (
330 const double *pXy
331 );
332 
338 double AngleTo (DPoint2dCR vector2) const;
339 
340 
344 bool IsParallelTo (DPoint2dCR vector2) const;
345 
349 bool IsPerpendicularTo (DPoint2dCR vector2) const;
350 
357 bool IsEqual (DPoint2dCR vector2) const;
358 
369 bool IsEqual (DPoint2dCR vector2, double tolerance) const;
370 
373 double MaxAbs () const;
374 
379 bool IsDisconnect () const;
380 
382 bool IsConvexPair () const;
383 
390 bool AlmostEqual (DPoint2d const & dataB) const;
391 
392 
393 #endif // __cplusplus
394 };
395 
397 #endif // dpoint2d_H_
Distance dimensional constraint.
struct DVec2d const & DVec2dCR
Definition: msgeomstructs_typedefs.h:90
double y
y coordinate
Definition: dpoint2d.h:28
#define BEGIN_BENTLEY_NAMESPACE
Definition: Bentley.r.h:24
double x
x coordinate
Definition: dpoint2d.h:26
struct DPoint2d const & DPoint2dCR
Definition: msgeomstructs_typedefs.h:78
#define END_BENTLEY_NAMESPACE
Definition: Bentley.r.h:25
struct DPoint3d const & DPoint3dCR
Definition: msgeomstructs_typedefs.h:79
2d point coordinates.
Definition: dpoint2d.h:23

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