diff options
author | smcauliffe <smcauliffe> | 2006-05-11 09:42:02 +0000 |
---|---|---|
committer | smcauliffe <smcauliffe@cb376a5e-1013-0410-a455-b6b1f9ac8223> | 2006-05-11 09:42:02 +0000 |
commit | 0e7e224b0794c642f678fad85ddd66e6aff6aa7a (patch) | |
tree | bcf8496e2727f2fe56caaee13ba8fcd484c6291e | |
parent | 79067ea4473cc324c8131bd4d8303efb8c0e2bb5 (diff) | |
download | reprap-0e7e224b0794c642f678fad85ddd66e6aff6aa7a.tar.gz reprap-0e7e224b0794c642f678fad85ddd66e6aff6aa7a.zip |
Merge from main trunk
git-svn-id: https://reprap.svn.sourceforge.net/svnroot/reprap@300 cb376a5e-1013-0410-a455-b6b1f9ac8223
3 files changed, 76 insertions, 4 deletions
diff --git a/branches/sm-unittesting/src/org/reprap/geometry/polygons/RrCSG.java b/branches/sm-unittesting/src/org/reprap/geometry/polygons/RrCSG.java index 1c7bfcc0..0e74b5fd 100755 --- a/branches/sm-unittesting/src/org/reprap/geometry/polygons/RrCSG.java +++ b/branches/sm-unittesting/src/org/reprap/geometry/polygons/RrCSG.java @@ -508,6 +508,7 @@ public class RrCSG { case 0: break; + case 1: switch(ops) { @@ -536,8 +537,12 @@ public class RrCSG System.err.println("reg_4() 2: addition doesn't work..."); } break; - case 2: - result = c1; + + case 2: // Pick the child that's an intersection (if there is one) + if(c1.op == RrCSGOp.UNION) + result = c2; + else + result = c1; break; default: @@ -596,7 +601,7 @@ public class RrCSG case RrCSGOp.LEAF: case RrCSGOp.NULL: case RrCSGOp.UNIVERSE: - //System.out.println("replace_all_same(): at a leaf!"); + //System.out.println("replace_all_same_leaves(): at a leaf!"); break; case RrCSGOp.UNION: diff --git a/branches/sm-unittesting/src/org/reprap/gui/Panel3D.java b/branches/sm-unittesting/src/org/reprap/gui/Panel3D.java index 001465b0..63414017 100644 --- a/branches/sm-unittesting/src/org/reprap/gui/Panel3D.java +++ b/branches/sm-unittesting/src/org/reprap/gui/Panel3D.java @@ -394,6 +394,9 @@ abstract public class Panel3D extends JPanel { double x2, double y2, double z2, float thickness) { + z1 += thickness / 2.0; + z2 += thickness / 2.0; + Point3d p1 = new Point3d(x1, y1, z1); //Point3d p2 = new Point3d(x2, y2, z2); @@ -429,7 +432,7 @@ abstract public class Panel3D extends JPanel { //Point3d p2 = new Point3d(x2, y2, z2); Vector3d unity = new Vector3d(0, 1, 0); - Vector3d v = new Vector3d(x2 - x1, y2 - y1, z2 - z1); + Vector3d v = new Vector3d(x2 - x1, y2 - y1, z2 - z1 + thickness / 2.0); Primitive segment = new Cylinder(thickness, (float)v.length(), appearance); diff --git a/trunk/reprap/host/src/org/reprap/machines/ReprapTest.java b/trunk/reprap/host/src/org/reprap/machines/ReprapTest.java new file mode 100644 index 00000000..30ee1ed1 --- /dev/null +++ b/trunk/reprap/host/src/org/reprap/machines/ReprapTest.java @@ -0,0 +1,64 @@ +package org.reprap.machines;
+
+import java.util.Properties;
+
+import org.reprap.Printer;
+import org.reprap.comms.port.TestPort;
+import org.reprap.comms.port.testhandlers.TestExtruder;
+import org.reprap.comms.port.testhandlers.TestStepper;
+import org.reprap.comms.snap.SNAPAddress;
+import org.testng.Assert;
+
+/**
+ *
+ * @testng.configuration groups = "comms,all,all-offline"
+ *
+ */
+public class ReprapTest {
+ private Printer printer;
+
+ /**
+ * @testng.configuration beforeSuite = "true"
+ */
+ public void setUp() throws Exception {
+ // Set up a configuration for testing
+ Properties props = new Properties();
+ props.setProperty("PortType", "test"); // Don't use a real port!
+ props.setProperty("Geometry", "cartesian");
+ props.setProperty("AxisCount", "3");
+ props.setProperty("ExtruderCount", "1");
+ props.setProperty("Axis1Address", "2");
+ props.setProperty("Axis2Address", "3");
+ props.setProperty("Axis3Address", "4");
+ props.setProperty("Axis1Torque", "100");
+ props.setProperty("Axis2Torque", "100");
+ props.setProperty("Axis3Torque", "100");
+ props.setProperty("Extruder1Address", "8");
+ props.setProperty("Extruder1Beta", "5000");
+ props.setProperty("Extruder1Rz", "100000");
+
+ TestPort port = new TestPort();
+ port.addDevice(new TestStepper(), new SNAPAddress(2));
+ port.addDevice(new TestStepper(), new SNAPAddress(3));
+ port.addDevice(new TestStepper(), new SNAPAddress(4));
+ port.addDevice(new TestExtruder(), new SNAPAddress(8));
+ printer = MachineFactory.create(props, port);
+ }
+
+ /**
+ * @testng.configuration afterSuite = "true"
+ */
+ public void tearDown() {
+ printer.dispose();
+ }
+
+ /**
+ * @testng.test groups = "comms,all,all-offline"
+ */
+ public void testReprapBasic() throws Exception {
+ printer.moveTo(0, 5, 0);
+ printer.printTo(10, 10, 0);
+ Assert.assertEquals(printer.getX(), 10.0, 0.001);
+ }
+
+}
|