summaryrefslogtreecommitdiffstats
path: root/dev/a4-dance/rotation_bounds.cc
diff options
context:
space:
mode:
authorMatt Strapp <matt@mattstrapp.net>2021-11-01 14:39:34 -0500
committerMatt Strapp <matt@mattstrapp.net>2021-11-01 14:39:34 -0500
commit36b8bde22e15e7a8608bd8920b4d6d8edf78af18 (patch)
tree1c022ce8d1854c6120ed492eb0bcad2e016e0f1f /dev/a4-dance/rotation_bounds.cc
parentdo a3 (diff)
parentUpdate a4_dance.md (diff)
downloadcsci4611-36b8bde22e15e7a8608bd8920b4d6d8edf78af18.tar
csci4611-36b8bde22e15e7a8608bd8920b4d6d8edf78af18.tar.gz
csci4611-36b8bde22e15e7a8608bd8920b4d6d8edf78af18.tar.bz2
csci4611-36b8bde22e15e7a8608bd8920b4d6d8edf78af18.tar.lz
csci4611-36b8bde22e15e7a8608bd8920b4d6d8edf78af18.tar.xz
csci4611-36b8bde22e15e7a8608bd8920b4d6d8edf78af18.tar.zst
csci4611-36b8bde22e15e7a8608bd8920b4d6d8edf78af18.zip
Merge branch 'support-code' of https://github.umn.edu/umn-csci-4611-f21/shared-upstream
Diffstat (limited to '')
-rw-r--r--dev/a4-dance/rotation_bounds.cc64
1 files changed, 64 insertions, 0 deletions
diff --git a/dev/a4-dance/rotation_bounds.cc b/dev/a4-dance/rotation_bounds.cc
new file mode 100644
index 0000000..a83b1ce
--- /dev/null
+++ b/dev/a4-dance/rotation_bounds.cc
@@ -0,0 +1,64 @@
+#include "rotation_bounds.h"
+#include <cstdlib>
+
+RotationBounds::RotationBounds() {
+ dofRX = false;
+ dofRY = false;
+ dofRZ = false;
+ minRX = 0;
+ maxRX = 0;
+ minRY = 0;
+ maxRY = 0;
+ minRZ = 0;
+ maxRZ = 0;
+ dofs = 0;
+}
+
+void RotationBounds::setdof(bool rx, bool ry, bool rz) {
+ dofRX = rx;
+ dofRY = ry;
+ dofRZ = rz;
+ dofs = rx + ry + rz;
+}
+
+void RotationBounds::setR(int index, float min, float max) {
+ if (index > dofs) {
+ std::abort(); // Trying to set past the max index.
+ }
+ if (index == 0) {
+ if (dofRX) {
+ minRX = min;
+ maxRX = max;
+ } else if (dofRY) {
+ minRY = min;
+ maxRY = max;
+ } else if (dofRZ) {
+ minRZ = min;
+ maxRZ = max;
+ } else {
+ abort();
+ }
+ } else if (index == 1) {
+ if (dofRX && dofRY) {
+ minRY = min;
+ maxRY = max;
+ } else if (dofRX && dofRZ) {
+ minRZ = min;
+ maxRZ = max;
+ } else if (dofRY && dofRZ) {
+ minRZ = min;
+ maxRZ = max;
+ } else {
+ abort();
+ }
+ } else if (index == 2) {
+ if (dofRX && dofRY && dofRZ) {
+ minRZ = min;
+ maxRZ = max;
+ } else {
+ abort();
+ }
+ } else {
+ abort();
+ }
+} \ No newline at end of file