Changeset 236 for cpp/frams/model
- Timestamp:
- 04/30/14 05:05:24 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/model/geometry/geometryutils.h
r193 r236 10 10 #include <frams/util/3d.h> 11 11 #include <frams/util/list.h> 12 13 //binary literals standardized in C++14 14 #define b000 0 15 #define b01 1 16 #define b001 1 17 #define b10 2 18 #define b010 2 19 #define b100 4 20 #define b110 6 12 21 13 22 namespace CuboidFaces … … 25 34 }; 26 35 27 inline bool isPositive(Face f) { return f & 0b001; }36 inline bool isPositive(Face f) { return f & b001; } 28 37 inline bool isNegative(Face f) { return !isPositive(f); } 29 inline bool isX(Face f) { return (f & 0b110) == 0b000; }30 inline bool isY(Face f) { return (f & 0b110) == 0b010; }31 inline bool isZ(Face f) { return (f & 0b110) == 0b100; }38 inline bool isX(Face f) { return (f & b110) == b000; } 39 inline bool isY(Face f) { return (f & b110) == b010; } 40 inline bool isZ(Face f) { return (f & b110) == b100; } 32 41 } 33 42 … … 42 51 }; 43 52 44 inline bool isPositive(Base b) { return b & 0b001; }53 inline bool isPositive(Base b) { return b & b001; } 45 54 inline bool isNegative(Base b) { return !isPositive(b); } 46 55 } … … 58 67 }; 59 68 60 inline bool isPositiveX(QuadrantXY q) { return q & 0b10; }69 inline bool isPositiveX(QuadrantXY q) { return q & b10; } 61 70 inline bool isNegativeX(QuadrantXY q) { return !isPositiveX(q); } 62 inline bool isPositiveY(QuadrantXY q) { return q & 0b01; }71 inline bool isPositiveY(QuadrantXY q) { return q & b01; } 63 72 inline bool isNegativeY(QuadrantXY q) { return !isPositiveY(q); } 64 73 } … … 76 85 }; 77 86 78 inline bool isPositiveY(QuadrantYZ q) { return q & 0b10; }87 inline bool isPositiveY(QuadrantYZ q) { return q & b10; } 79 88 inline bool isNegativeY(QuadrantYZ q) { return !isPositiveY(q); } 80 inline bool isPositiveZ(QuadrantYZ q) { return q & 0b01; }89 inline bool isPositiveZ(QuadrantYZ q) { return q & b01; } 81 90 inline bool isNegativeZ(QuadrantYZ q) { return !isPositiveZ(q); } 82 91 } … … 94 103 }; 95 104 96 inline bool isPositiveZ(QuadrantZX q) { return q & 0b10; }105 inline bool isPositiveZ(QuadrantZX q) { return q & b10; } 97 106 inline bool isNegativeZ(QuadrantZX q) { return !isPositiveZ(q); } 98 inline bool isPositiveX(QuadrantZX q) { return q & 0b01; }107 inline bool isPositiveX(QuadrantZX q) { return q & b01; } 99 108 inline bool isNegativeX(QuadrantZX q) { return !isPositiveX(q); } 100 109 } … … 116 125 }; 117 126 118 inline bool isPositiveX(Octant o) { return o & 0b100; }127 inline bool isPositiveX(Octant o) { return o & b100; } 119 128 inline bool isNegativeX(Octant o) { return !isPositiveX(o); } 120 inline bool isPositiveY(Octant o) { return o & 0b010; }129 inline bool isPositiveY(Octant o) { return o & b010; } 121 130 inline bool isNegativeY(Octant o) { return !isPositiveY(o); } 122 inline bool isPositiveZ(Octant o) { return o & 0b001; }131 inline bool isPositiveZ(Octant o) { return o & b001; } 123 132 inline bool isNegativeZ(Octant o) { return !isPositiveZ(o); } 124 133 }
Note: See TracChangeset
for help on using the changeset viewer.