pointset_math.h Source File - ClanLib SDK
Description: pointset_math.h Source File

pointset_math.h
1/*
2** ClanLib SDK
3** Copyright (c) 1997-2020 The ClanLib Team
4**
5** This software is provided 'as-is', without any express or implied
6** warranty. In no event will the authors be held liable for any damages
7** arising from the use of this software.
8**
9** Permission is granted to anyone to use this software for any purpose,
10** including commercial applications, and to alter it and redistribute it
11** freely, subject to the following restrictions:
12**
13** 1. The origin of this software must not be misrepresented; you must not
14** claim that you wrote the original software. If you use this software
15** in a product, an acknowledgment in the product documentation would be
16** appreciated but is not required.
17** 2. Altered source versions must be plainly marked as such, and must not be
18** misrepresented as being the original software.
19** 3. This notice may not be removed or altered from any source distribution.
20**
21** Note: Some of the libraries ClanLib may link to may have additional
22** requirements or restrictions.
23**
24** File Author(s):
25**
26** Emanuel Griesen
27** Harry Storbacka
28*/
29
30#pragma once
31
32#include <vector>
33#include "point.h"
34#include "circle.h"
35#include "rect.h"
36
37namespace clan
38{
41
43 class PointSetMath
44 {
45 public:
49 static Circlef minimum_enclosing_disc(
50 const std::vector<Pointf> &points);
51
55 static std::vector<Pointf> convex_hull_from_polygon(std::vector<Pointf> &points);
56
57 static Rect bounding_box(const std::vector<Pointf> &points);
58
59 static void calculate_minimum_enclosing_disc(
60 Circlef &smalldisc,
61 const std::vector<Pointf> &points,
62 int start,
63 int end);
64
65 static void minimum_disc_with_1point(
66 Circlef &smalldisc,
67 const std::vector<Pointf> &points,
68 int start,
69 unsigned int i);
70
71 static void minimum_disc_with_2points(
72 Circlef &smalldisc,
73 const std::vector<Pointf> &points,
74 int start,
75 unsigned int i,
76 unsigned int j);
77
78 static void minimum_disc_with_3points(
79 Circlef &smalldisc,
80 const std::vector<Pointf> &points,
81 unsigned int i,
82 unsigned int j,
83 unsigned int k);
84
85 };
86
88}
clan::Circlef
Circle - Float.
Definition circle.h:76
clan::PointSetMath
Math operations related to point sets.
Definition pointset_math.h:44
clan::PointSetMath::bounding_box
static Rect bounding_box(const std::vector< Pointf > &points)
clan::PointSetMath::minimum_disc_with_3points
static void minimum_disc_with_3points(Circlef &smalldisc, const std::vector< Pointf > &points, unsigned int i, unsigned int j, unsigned int k)
clan::PointSetMath::minimum_enclosing_disc
static Circlef minimum_enclosing_disc(const std::vector< Pointf > &points)
Find minimum spanning circle for the set of points.
clan::PointSetMath::minimum_disc_with_2points
static void minimum_disc_with_2points(Circlef &smalldisc, const std::vector< Pointf > &points, int start, unsigned int i, unsigned int j)
clan::PointSetMath::convex_hull_from_polygon
static std::vector< Pointf > convex_hull_from_polygon(std::vector< Pointf > &points)
Return the convex hull of the given set of points.
clan::PointSetMath::calculate_minimum_enclosing_disc
static void calculate_minimum_enclosing_disc(Circlef &smalldisc, const std::vector< Pointf > &points, int start, int end)
clan::PointSetMath::minimum_disc_with_1point
static void minimum_disc_with_1point(Circlef &smalldisc, const std::vector< Pointf > &points, int start, unsigned int i)
clan::Rect
2D (left,top,right,bottom) rectangle structure - Integer
Definition rect.h:446
clan::PrimitivesType::points
@ points
Definition graphic_context.h:221
clan
Definition clanapp.h:36
clan::Key::j
@ j
Definition keys.h:90
clan::Key::end
@ end
Definition keys.h:57
clan::Key::i
@ i
Definition keys.h:89
clan::Key::k
@ k
Definition keys.h:91