contour.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2013 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 ** Harry Storbacka
27 ** Magnus Norddahl
28 ** Kenneth Gangstoe
29 ** Mark Page
30 */
31 
32 
33 #pragma once
34 
35 #include "../api_display.h"
36 #include <memory>
37 #include <vector>
38 
39 namespace clan
40 {
43 
44 class Contour_Impl;
45 class OutlineCircle;
46 class Pointf;
47 
51 class Contour
52 {
55 public:
57  Contour();
58  ~Contour();
59 
63 public:
64  // Points forming the countour.
65  std::vector<Pointf> &get_points();
66  const std::vector<Pointf> &get_points() const;
67 
68  // boolean specifying if this contour is inside-out (the inside of a hollow polygon)
69  // if that is the case, then the collision-test will skip the inside_contour-test (because you can
70  // be inside this one, without causing a collision)
71  bool is_inside_contour() const;
72 
76  void set_inside_contour(bool is_inside);
77 
78  // Circles encapsulating a part of the outline.
79  // If two circles arent intersecting, none of the lines inside them
80  // collide either.
81  std::vector<OutlineCircle> &get_sub_circles();
82  const std::vector<OutlineCircle> &get_sub_circles() const;
84 
87 public:
89  bool operator==(const Contour &other) const;
90 
92  bool operator!=(const Contour &other) const;
93 
95  bool operator<(const Contour &other) const;
96 
98  Contour clone() const;
100 
103 private:
104  std::shared_ptr<Contour_Impl> impl;
106 };
107 
108 }
109 
Contour()
Construct a contour.
bool operator!=(const Contour &other) const
Inequality operator.
void set_inside_contour(bool is_inside)
Set inside contour.
bool operator<(const Contour &other) const
Less than operator.
bool is_inside_contour() const
Collision detection contour.
Definition: contour.h:51
bool operator==(const Contour &other) const
Equality operator.
Contour clone() const
Makes a copy of the contour.
std::vector< Pointf > & get_points()
std::vector< OutlineCircle > & get_sub_circles()