-
Notifications
You must be signed in to change notification settings - Fork 2
/
Convexhull.h
57 lines (44 loc) · 2.39 KB
/
Convexhull.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// Created by Ryan.Zurrin001 on 12/15/2021.
//
#ifndef PHYSICSFORMULA_CONVEXHULL_H
#define PHYSICSFORMULA_CONVEXHULL_H
#include <vector>
#include <iostream>
#include "Point.h"
#include "Polygon.h"
#include "Polyhedron.h"
namespace rez
{
// Note : All the 2D algorithms assume the provided points are in single plane. If not the result could be wrong
// Compute the points in the convex hull.
// Assumptions : (Preprocess the points sets to satisfy following assumptions)
// The points are in XY 2D plane.
// No duplicate points.
void convexhull2DGiftwrapping(std::vector<Point2d>& _points, std::vector<Point2d>& _convex);
// Compute the points in the convex hull. Assume the points are in XY 2D plane.
// Note : Order of the [_points] will be changed due to internal sort calls
// Assumptions : (Preprocess the points sets to satisfy following assumptions)
// The points are in XY 2D plane.
// No duplicate points.
void convexhull2DModifiedGrahams(std::vector<Point2d>& _points, std::vector<Point2d>& _convex);
// Compute the points in the convex hull in incremental way. Assume the points are in XY 2D plane.
// Pre order the points from left to right to reduce the time
// Explain why we need pre sorting
void convexhull2DIncremental(std::vector<Point3d>& _points, std::vector<Point3d>& _convex);
// Compute the points in the convex hull by following divide and conquire methodology.
// Assume the points are in XY 2D plane.
void convexhull2DDivideAndConquer(std::vector<Point3d>& _points, Polygon& _results);
// Compute the points in the convex hull.
// Assume the points are in XY 2D plane.
// Keep in mind Points in _convex is in the convex hull but not in any perticular order.
// - So need to correct the order before using to construct a polygon
void convexhull2DQuickhull(std::vector<Point3d>& _points, std::vector<Point3d>& _convex);
// Compute the points in the convex hull in 3D space using incremental methodology.
// Assume there are no duplicate points.
void convexhull3D(std::vector<Point3d>& _points, std::vector<Face*>& faces);
// Compute the points in the convex hull.
// TODO : Have not implemented yet
void convexhull3DQuickhull(std::vector<Point3d>& _points, Polygon& _results);
}
#endif //PHYSICSFORMULA_CONVEXHULL_H