ALBA
albaGeometryUtils.h
Go to the documentation of this file.
1/*=========================================================================
2Program: ALBA (Agile Library for Biomedical Applications)
3Module: albaGeometryUtils.h
4Language: C++
5Date: $Date: 2022-01-01 12:00:00 $
6Version: $Revision: 1.0.0.0 $
7Authors: Nicola Vanella
8==========================================================================
9Copyright (c) BIC-IOR 2021 (https://github.com/IOR-BIC)
10
11This software is distributed WITHOUT ANY WARRANTY; without even
12the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13PURPOSE. See the above copyright notice for more information.
14=========================================================================*/
15
16#ifndef __albaGeometryUtils_h
17#define __albaGeometryUtils_h
18
19//----------------------------------------------------------------------------
20// includes :
21//----------------------------------------------------------------------------
22
27{
28protected:
29 enum { X, Y, Z, };
30 enum { XY, YZ, XZ, };
31
32public:
33
34 static double Dot(double *point1, double *point2);
35 static double Mag(double *point1);
36
37 static float Norm2(double *point1);
38 static double Norm(double *point1);
39
40 static void Cross(double *point1, double *point2, double* cross);
41
42
43 static bool Equal(double *point1, double *point2);
44
45 static double DistanceBetweenPoints(double *point1, double *point2);
46
47 static void GetMidPoint(double(&midPoint)[3], double *point1, double *point2);
48
49 /*plane default 0=XY, 1=YZ, 2=XZ*/
50 static double DistancePointToLine(double * point, double * lineP1, double * lineP2, int plane = XY);
51
52 /*plane default 0=XY, 1=YZ, 2=XZ*/
53 static double GetAngle(double* point1, double* point2, double* origin, int plane = XY);
54 static double GetAngle(double point1[3], double point2[3]);
55
56 /*plane default 0=XY, 1=YZ, 2=XZ*/
57 static void RotatePoint(double *point, double *origin, double angle, int plane = XY);
58
60
61 static bool GetLineLineIntersection(double(&point)[3], double *line1Point1, double *line1Point2, double *line2Point1, double *line2Point2, int plane = XY);
62
63 static int IntersectLineLine(double *l1p1, double *l1p2, double *l2p1, double *l2p2, double &perc);
64
65 /*plane default 0=XY, 1=YZ, 2=XZ*/
66 static void GetParallelLine(double(&point1)[3], double(&point2)[3], double *linePoint1, double *linePoint2, double distance, int plane = XY);
67
68 static bool FindPointOnLine(double(&point)[3], double *linePoint1, double *linePoint2, double distance, int plane = XY);
69
70 //Returns 1 if the point is up, -1 if is down and 0 if the point is in the line (plane default 0=XY, 1=YZ, 2=XZ)
71 static int PointUpDownLine(double *point, double *lp1, double *lp2, int plane = XY);
72
73};
74#endif
Class Name: albaGeometryUtils.
static bool FindPointOnLine(double(&point)[3], double *linePoint1, double *linePoint2, double distance, int plane=XY)
static bool GetLineLineIntersection(double(&point)[3], double *line1Point1, double *line1Point2, double *line2Point1, double *line2Point2, int plane=XY)
Lines.
static void Cross(double *point1, double *point2, double *cross)
static void GetParallelLine(double(&point1)[3], double(&point2)[3], double *linePoint1, double *linePoint2, double distance, int plane=XY)
static void RotatePoint(double *point, double *origin, double angle, int plane=XY)
static float Norm2(double *point1)
static void GetMidPoint(double(&midPoint)[3], double *point1, double *point2)
static double Mag(double *point1)
static bool Equal(double *point1, double *point2)
static double Dot(double *point1, double *point2)
static double GetAngle(double *point1, double *point2, double *origin, int plane=XY)
static int IntersectLineLine(double *l1p1, double *l1p2, double *l2p1, double *l2p2, double &perc)
static double DistancePointToLine(double *point, double *lineP1, double *lineP2, int plane=XY)
static double DistanceBetweenPoints(double *point1, double *point2)
static int PointUpDownLine(double *point, double *lp1, double *lp2, int plane=XY)
static double Norm(double *point1)
static double GetAngle(double point1[3], double point2[3])