Added the necessery classes to handle symmetry objects/mirrors in symbols; What used to be SymbolPart is now SymbolShape, SymbolPart is a base class.

This should also pave the way for grouping.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@526 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-07-08 01:12:55 +00:00
parent 0deb8513fd
commit b46d979f9e
31 changed files with 616 additions and 375 deletions
+6 -6
View File
@@ -141,17 +141,17 @@ bool point_in_bounds(const Vector2D& p, const Vector2D& min, const Vector2D& max
// ----------------------------------------------------------------------------- : Point tests
// As a point inside a symbol part?
bool point_in_part(const Vector2D& pos, const SymbolPart& part) {
// Is a point inside a symbol shape?
bool point_in_shape(const Vector2D& pos, const SymbolShape& shape) {
// Step 1. compare bounding box of the part
if (!point_in_bounds(pos, part.min_pos, part.max_pos)) return false;
if (!point_in_bounds(pos, shape.min_pos, shape.max_pos)) return false;
// Step 2. trace ray outward, count intersections
int count = 0;
size_t size = part.points.size();
size_t size = shape.points.size();
for(size_t i = 0 ; i < size ; ++i) {
ControlPointP p1 = part.getPoint((int) i);
ControlPointP p2 = part.getPoint((int) i + 1);
ControlPointP p1 = shape.getPoint((int) i);
ControlPointP p2 = shape.getPoint((int) i + 1);
if (p1->segment_after == SEGMENT_LINE) {
count += intersect_line_ray (p1->pos, p2->pos, pos);
} else {
+2 -2
View File
@@ -98,8 +98,8 @@ void point_bounds(const Vector2D& p, Vector2D& min, Vector2D& max);
// ----------------------------------------------------------------------------- : Point tests
/// Is a point inside the given symbol part?
bool point_in_part(const Vector2D& p, const SymbolPart& part);
/// Is a point inside the given shape?
bool point_in_shape(const Vector2D& p, const SymbolShape& part);
// ----------------------------------------------------------------------------- : Finding points