summaryrefslogtreecommitdiffstats
path: root/src/axis-manip.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/axis-manip.h')
-rw-r--r--src/axis-manip.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/axis-manip.h b/src/axis-manip.h
index 5690eedcb..8574bf3ff 100644
--- a/src/axis-manip.h
+++ b/src/axis-manip.h
@@ -75,6 +75,16 @@ inline bool is_single_axis_direction (Box3D::Axis dir) {
return (!(dir & (dir - 1)) && dir);
}
+// Warning: We don't check that axis really unamiguously specifies a plane.
+// Make sure this is the case when calling this function.
+inline guint face_containing_corner (Box3D::Axis axis, guint corner) {
+ if (!is_single_axis_direction (axis)) {
+ axis = (Box3D::Axis) (axis ^ Box3D::XYZ);
+ }
+ return face_to_int (axis ^ ((corner & axis) ? Box3D::REAR : Box3D::FRONT));
+}
+
+
/**
* Given two axis directions out of {X, Y, Z} or the corresponding plane, return the remaining one
* We don't check if 'plane' really specifies a plane (i.e., if it consists of precisely two directions).