commons-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r948064 [33/38] - in /websites/production/commons/content/proper/commons-math/testapidocs: ./ org/apache/commons/math3/ org/apache/commons/math3/analysis/ org/apache/commons/math3/analysis/class-use/ org/apache/commons/math3/analysis/differ...
Date Fri, 17 Apr 2015 19:44:43 GMT
Modified: websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSetTest.html
==============================================================================
--- websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSetTest.html (original)
+++ websites/production/commons/content/proper/commons-math/testapidocs/src-html/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSetTest.html Fri Apr 17 19:43:52 2015
@@ -24,304 +24,467 @@
 <span class="sourceLineNo">016</span> */<a name="line.16"></a>
 <span class="sourceLineNo">017</span>package org.apache.commons.math3.geometry.euclidean.threed;<a name="line.17"></a>
 <span class="sourceLineNo">018</span><a name="line.18"></a>
-<span class="sourceLineNo">019</span>import java.util.ArrayList;<a name="line.19"></a>
-<span class="sourceLineNo">020</span><a name="line.20"></a>
-<span class="sourceLineNo">021</span>import org.apache.commons.math3.exception.MathArithmeticException;<a name="line.21"></a>
-<span class="sourceLineNo">022</span>import org.apache.commons.math3.exception.MathIllegalArgumentException;<a name="line.22"></a>
-<span class="sourceLineNo">023</span>import org.apache.commons.math3.geometry.Vector;<a name="line.23"></a>
-<span class="sourceLineNo">024</span>import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;<a name="line.24"></a>
-<span class="sourceLineNo">025</span>import org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet;<a name="line.25"></a>
-<span class="sourceLineNo">026</span>import org.apache.commons.math3.geometry.euclidean.twod.SubLine;<a name="line.26"></a>
-<span class="sourceLineNo">027</span>import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;<a name="line.27"></a>
-<span class="sourceLineNo">028</span>import org.apache.commons.math3.geometry.partitioning.BSPTree;<a name="line.28"></a>
-<span class="sourceLineNo">029</span>import org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor;<a name="line.29"></a>
-<span class="sourceLineNo">030</span>import org.apache.commons.math3.geometry.partitioning.BoundaryAttribute;<a name="line.30"></a>
-<span class="sourceLineNo">031</span>import org.apache.commons.math3.geometry.partitioning.Region;<a name="line.31"></a>
-<span class="sourceLineNo">032</span>import org.apache.commons.math3.geometry.partitioning.RegionFactory;<a name="line.32"></a>
-<span class="sourceLineNo">033</span>import org.apache.commons.math3.geometry.partitioning.SubHyperplane;<a name="line.33"></a>
-<span class="sourceLineNo">034</span>import org.apache.commons.math3.util.FastMath;<a name="line.34"></a>
-<span class="sourceLineNo">035</span>import org.junit.Assert;<a name="line.35"></a>
-<span class="sourceLineNo">036</span>import org.junit.Test;<a name="line.36"></a>
-<span class="sourceLineNo">037</span><a name="line.37"></a>
-<span class="sourceLineNo">038</span>public class PolyhedronsSetTest {<a name="line.38"></a>
-<span class="sourceLineNo">039</span><a name="line.39"></a>
-<span class="sourceLineNo">040</span>    @Test<a name="line.40"></a>
-<span class="sourceLineNo">041</span>    public void testBox() {<a name="line.41"></a>
-<span class="sourceLineNo">042</span>        PolyhedronsSet tree = new PolyhedronsSet(0, 1, 0, 1, 0, 1, 1.0e-10);<a name="line.42"></a>
-<span class="sourceLineNo">043</span>        Assert.assertEquals(1.0, tree.getSize(), 1.0e-10);<a name="line.43"></a>
-<span class="sourceLineNo">044</span>        Assert.assertEquals(6.0, tree.getBoundarySize(), 1.0e-10);<a name="line.44"></a>
-<span class="sourceLineNo">045</span>        Vector3D barycenter = (Vector3D) tree.getBarycenter();<a name="line.45"></a>
-<span class="sourceLineNo">046</span>        Assert.assertEquals(0.5, barycenter.getX(), 1.0e-10);<a name="line.46"></a>
-<span class="sourceLineNo">047</span>        Assert.assertEquals(0.5, barycenter.getY(), 1.0e-10);<a name="line.47"></a>
-<span class="sourceLineNo">048</span>        Assert.assertEquals(0.5, barycenter.getZ(), 1.0e-10);<a name="line.48"></a>
-<span class="sourceLineNo">049</span>        for (double x = -0.25; x &lt; 1.25; x += 0.1) {<a name="line.49"></a>
-<span class="sourceLineNo">050</span>            boolean xOK = (x &gt;= 0.0) &amp;&amp; (x &lt;= 1.0);<a name="line.50"></a>
-<span class="sourceLineNo">051</span>            for (double y = -0.25; y &lt; 1.25; y += 0.1) {<a name="line.51"></a>
-<span class="sourceLineNo">052</span>                boolean yOK = (y &gt;= 0.0) &amp;&amp; (y &lt;= 1.0);<a name="line.52"></a>
-<span class="sourceLineNo">053</span>                for (double z = -0.25; z &lt; 1.25; z += 0.1) {<a name="line.53"></a>
-<span class="sourceLineNo">054</span>                    boolean zOK = (z &gt;= 0.0) &amp;&amp; (z &lt;= 1.0);<a name="line.54"></a>
-<span class="sourceLineNo">055</span>                    Region.Location expected =<a name="line.55"></a>
-<span class="sourceLineNo">056</span>                        (xOK &amp;&amp; yOK &amp;&amp; zOK) ? Region.Location.INSIDE : Region.Location.OUTSIDE;<a name="line.56"></a>
-<span class="sourceLineNo">057</span>                    Assert.assertEquals(expected, tree.checkPoint(new Vector3D(x, y, z)));<a name="line.57"></a>
-<span class="sourceLineNo">058</span>                }<a name="line.58"></a>
-<span class="sourceLineNo">059</span>            }<a name="line.59"></a>
-<span class="sourceLineNo">060</span>        }<a name="line.60"></a>
-<span class="sourceLineNo">061</span>        checkPoints(Region.Location.BOUNDARY, tree, new Vector3D[] {<a name="line.61"></a>
-<span class="sourceLineNo">062</span>            new Vector3D(0.0, 0.5, 0.5),<a name="line.62"></a>
-<span class="sourceLineNo">063</span>            new Vector3D(1.0, 0.5, 0.5),<a name="line.63"></a>
-<span class="sourceLineNo">064</span>            new Vector3D(0.5, 0.0, 0.5),<a name="line.64"></a>
-<span class="sourceLineNo">065</span>            new Vector3D(0.5, 1.0, 0.5),<a name="line.65"></a>
-<span class="sourceLineNo">066</span>            new Vector3D(0.5, 0.5, 0.0),<a name="line.66"></a>
-<span class="sourceLineNo">067</span>            new Vector3D(0.5, 0.5, 1.0)<a name="line.67"></a>
-<span class="sourceLineNo">068</span>        });<a name="line.68"></a>
-<span class="sourceLineNo">069</span>        checkPoints(Region.Location.OUTSIDE, tree, new Vector3D[] {<a name="line.69"></a>
-<span class="sourceLineNo">070</span>            new Vector3D(0.0, 1.2, 1.2),<a name="line.70"></a>
-<span class="sourceLineNo">071</span>            new Vector3D(1.0, 1.2, 1.2),<a name="line.71"></a>
-<span class="sourceLineNo">072</span>            new Vector3D(1.2, 0.0, 1.2),<a name="line.72"></a>
-<span class="sourceLineNo">073</span>            new Vector3D(1.2, 1.0, 1.2),<a name="line.73"></a>
-<span class="sourceLineNo">074</span>            new Vector3D(1.2, 1.2, 0.0),<a name="line.74"></a>
-<span class="sourceLineNo">075</span>            new Vector3D(1.2, 1.2, 1.0)<a name="line.75"></a>
-<span class="sourceLineNo">076</span>        });<a name="line.76"></a>
-<span class="sourceLineNo">077</span>    }<a name="line.77"></a>
-<span class="sourceLineNo">078</span><a name="line.78"></a>
-<span class="sourceLineNo">079</span>    @Test<a name="line.79"></a>
-<span class="sourceLineNo">080</span>    public void testTetrahedron() throws MathArithmeticException {<a name="line.80"></a>
-<span class="sourceLineNo">081</span>        Vector3D vertex1 = new Vector3D(1, 2, 3);<a name="line.81"></a>
-<span class="sourceLineNo">082</span>        Vector3D vertex2 = new Vector3D(2, 2, 4);<a name="line.82"></a>
-<span class="sourceLineNo">083</span>        Vector3D vertex3 = new Vector3D(2, 3, 3);<a name="line.83"></a>
-<span class="sourceLineNo">084</span>        Vector3D vertex4 = new Vector3D(1, 3, 4);<a name="line.84"></a>
-<span class="sourceLineNo">085</span>        @SuppressWarnings("unchecked")<a name="line.85"></a>
-<span class="sourceLineNo">086</span>        PolyhedronsSet tree =<a name="line.86"></a>
-<span class="sourceLineNo">087</span>            (PolyhedronsSet) new RegionFactory&lt;Euclidean3D&gt;().buildConvex(<a name="line.87"></a>
-<span class="sourceLineNo">088</span>                new Plane(vertex3, vertex2, vertex1, 1.0e-10),<a name="line.88"></a>
-<span class="sourceLineNo">089</span>                new Plane(vertex2, vertex3, vertex4, 1.0e-10),<a name="line.89"></a>
-<span class="sourceLineNo">090</span>                new Plane(vertex4, vertex3, vertex1, 1.0e-10),<a name="line.90"></a>
-<span class="sourceLineNo">091</span>                new Plane(vertex1, vertex2, vertex4, 1.0e-10));<a name="line.91"></a>
-<span class="sourceLineNo">092</span>        Assert.assertEquals(1.0 / 3.0, tree.getSize(), 1.0e-10);<a name="line.92"></a>
-<span class="sourceLineNo">093</span>        Assert.assertEquals(2.0 * FastMath.sqrt(3.0), tree.getBoundarySize(), 1.0e-10);<a name="line.93"></a>
-<span class="sourceLineNo">094</span>        Vector3D barycenter = (Vector3D) tree.getBarycenter();<a name="line.94"></a>
-<span class="sourceLineNo">095</span>        Assert.assertEquals(1.5, barycenter.getX(), 1.0e-10);<a name="line.95"></a>
-<span class="sourceLineNo">096</span>        Assert.assertEquals(2.5, barycenter.getY(), 1.0e-10);<a name="line.96"></a>
-<span class="sourceLineNo">097</span>        Assert.assertEquals(3.5, barycenter.getZ(), 1.0e-10);<a name="line.97"></a>
-<span class="sourceLineNo">098</span>        double third = 1.0 / 3.0;<a name="line.98"></a>
-<span class="sourceLineNo">099</span>        checkPoints(Region.Location.BOUNDARY, tree, new Vector3D[] {<a name="line.99"></a>
-<span class="sourceLineNo">100</span>            vertex1, vertex2, vertex3, vertex4,<a name="line.100"></a>
-<span class="sourceLineNo">101</span>            new Vector3D(third, vertex1, third, vertex2, third, vertex3),<a name="line.101"></a>
-<span class="sourceLineNo">102</span>            new Vector3D(third, vertex2, third, vertex3, third, vertex4),<a name="line.102"></a>
-<span class="sourceLineNo">103</span>            new Vector3D(third, vertex3, third, vertex4, third, vertex1),<a name="line.103"></a>
-<span class="sourceLineNo">104</span>            new Vector3D(third, vertex4, third, vertex1, third, vertex2)<a name="line.104"></a>
-<span class="sourceLineNo">105</span>        });<a name="line.105"></a>
-<span class="sourceLineNo">106</span>        checkPoints(Region.Location.OUTSIDE, tree, new Vector3D[] {<a name="line.106"></a>
-<span class="sourceLineNo">107</span>            new Vector3D(1, 2, 4),<a name="line.107"></a>
-<span class="sourceLineNo">108</span>            new Vector3D(2, 2, 3),<a name="line.108"></a>
-<span class="sourceLineNo">109</span>            new Vector3D(2, 3, 4),<a name="line.109"></a>
-<span class="sourceLineNo">110</span>            new Vector3D(1, 3, 3)<a name="line.110"></a>
-<span class="sourceLineNo">111</span>        });<a name="line.111"></a>
-<span class="sourceLineNo">112</span>    }<a name="line.112"></a>
-<span class="sourceLineNo">113</span><a name="line.113"></a>
-<span class="sourceLineNo">114</span>    @Test<a name="line.114"></a>
-<span class="sourceLineNo">115</span>    public void testIsometry() throws MathArithmeticException, MathIllegalArgumentException {<a name="line.115"></a>
-<span class="sourceLineNo">116</span>        Vector3D vertex1 = new Vector3D(1.1, 2.2, 3.3);<a name="line.116"></a>
-<span class="sourceLineNo">117</span>        Vector3D vertex2 = new Vector3D(2.0, 2.4, 4.2);<a name="line.117"></a>
-<span class="sourceLineNo">118</span>        Vector3D vertex3 = new Vector3D(2.8, 3.3, 3.7);<a name="line.118"></a>
-<span class="sourceLineNo">119</span>        Vector3D vertex4 = new Vector3D(1.0, 3.6, 4.5);<a name="line.119"></a>
-<span class="sourceLineNo">120</span>        @SuppressWarnings("unchecked")<a name="line.120"></a>
-<span class="sourceLineNo">121</span>        PolyhedronsSet tree =<a name="line.121"></a>
-<span class="sourceLineNo">122</span>            (PolyhedronsSet) new RegionFactory&lt;Euclidean3D&gt;().buildConvex(<a name="line.122"></a>
-<span class="sourceLineNo">123</span>                new Plane(vertex3, vertex2, vertex1, 1.0e-10),<a name="line.123"></a>
-<span class="sourceLineNo">124</span>                new Plane(vertex2, vertex3, vertex4, 1.0e-10),<a name="line.124"></a>
-<span class="sourceLineNo">125</span>                new Plane(vertex4, vertex3, vertex1, 1.0e-10),<a name="line.125"></a>
-<span class="sourceLineNo">126</span>                new Plane(vertex1, vertex2, vertex4, 1.0e-10));<a name="line.126"></a>
-<span class="sourceLineNo">127</span>        Vector3D barycenter = (Vector3D) tree.getBarycenter();<a name="line.127"></a>
-<span class="sourceLineNo">128</span>        Vector3D s = new Vector3D(10.2, 4.3, -6.7);<a name="line.128"></a>
-<span class="sourceLineNo">129</span>        Vector3D c = new Vector3D(-0.2, 2.1, -3.2);<a name="line.129"></a>
-<span class="sourceLineNo">130</span>        Rotation r = new Rotation(new Vector3D(6.2, -4.4, 2.1), 0.12);<a name="line.130"></a>
-<span class="sourceLineNo">131</span><a name="line.131"></a>
-<span class="sourceLineNo">132</span>        tree = tree.rotate(c, r).translate(s);<a name="line.132"></a>
-<span class="sourceLineNo">133</span><a name="line.133"></a>
-<span class="sourceLineNo">134</span>        Vector3D newB =<a name="line.134"></a>
-<span class="sourceLineNo">135</span>            new Vector3D(1.0, s,<a name="line.135"></a>
-<span class="sourceLineNo">136</span>                         1.0, c,<a name="line.136"></a>
-<span class="sourceLineNo">137</span>                         1.0, r.applyTo(barycenter.subtract(c)));<a name="line.137"></a>
-<span class="sourceLineNo">138</span>        Assert.assertEquals(0.0,<a name="line.138"></a>
-<span class="sourceLineNo">139</span>                            newB.subtract((Vector&lt;Euclidean3D&gt;) tree.getBarycenter()).getNorm(),<a name="line.139"></a>
-<span class="sourceLineNo">140</span>                            1.0e-10);<a name="line.140"></a>
-<span class="sourceLineNo">141</span><a name="line.141"></a>
-<span class="sourceLineNo">142</span>        final Vector3D[] expectedV = new Vector3D[] {<a name="line.142"></a>
-<span class="sourceLineNo">143</span>            new Vector3D(1.0, s,<a name="line.143"></a>
-<span class="sourceLineNo">144</span>                         1.0, c,<a name="line.144"></a>
-<span class="sourceLineNo">145</span>                         1.0, r.applyTo(vertex1.subtract(c))),<a name="line.145"></a>
-<span class="sourceLineNo">146</span>                         new Vector3D(1.0, s,<a name="line.146"></a>
-<span class="sourceLineNo">147</span>                                      1.0, c,<a name="line.147"></a>
-<span class="sourceLineNo">148</span>                                      1.0, r.applyTo(vertex2.subtract(c))),<a name="line.148"></a>
-<span class="sourceLineNo">149</span>                                      new Vector3D(1.0, s,<a name="line.149"></a>
-<span class="sourceLineNo">150</span>                                                   1.0, c,<a name="line.150"></a>
-<span class="sourceLineNo">151</span>                                                   1.0, r.applyTo(vertex3.subtract(c))),<a name="line.151"></a>
-<span class="sourceLineNo">152</span>                                                   new Vector3D(1.0, s,<a name="line.152"></a>
-<span class="sourceLineNo">153</span>                                                                1.0, c,<a name="line.153"></a>
-<span class="sourceLineNo">154</span>                                                                1.0, r.applyTo(vertex4.subtract(c)))<a name="line.154"></a>
-<span class="sourceLineNo">155</span>        };<a name="line.155"></a>
-<span class="sourceLineNo">156</span>        tree.getTree(true).visit(new BSPTreeVisitor&lt;Euclidean3D&gt;() {<a name="line.156"></a>
-<span class="sourceLineNo">157</span><a name="line.157"></a>
-<span class="sourceLineNo">158</span>            public Order visitOrder(BSPTree&lt;Euclidean3D&gt; node) {<a name="line.158"></a>
-<span class="sourceLineNo">159</span>                return Order.MINUS_SUB_PLUS;<a name="line.159"></a>
-<span class="sourceLineNo">160</span>            }<a name="line.160"></a>
-<span class="sourceLineNo">161</span><a name="line.161"></a>
-<span class="sourceLineNo">162</span>            public void visitInternalNode(BSPTree&lt;Euclidean3D&gt; node) {<a name="line.162"></a>
-<span class="sourceLineNo">163</span>                @SuppressWarnings("unchecked")<a name="line.163"></a>
-<span class="sourceLineNo">164</span>                BoundaryAttribute&lt;Euclidean3D&gt; attribute =<a name="line.164"></a>
-<span class="sourceLineNo">165</span>                    (BoundaryAttribute&lt;Euclidean3D&gt;) node.getAttribute();<a name="line.165"></a>
-<span class="sourceLineNo">166</span>                if (attribute.getPlusOutside() != null) {<a name="line.166"></a>
-<span class="sourceLineNo">167</span>                    checkFacet((SubPlane) attribute.getPlusOutside());<a name="line.167"></a>
-<span class="sourceLineNo">168</span>                }<a name="line.168"></a>
-<span class="sourceLineNo">169</span>                if (attribute.getPlusInside() != null) {<a name="line.169"></a>
-<span class="sourceLineNo">170</span>                    checkFacet((SubPlane) attribute.getPlusInside());<a name="line.170"></a>
-<span class="sourceLineNo">171</span>                }<a name="line.171"></a>
-<span class="sourceLineNo">172</span>            }<a name="line.172"></a>
-<span class="sourceLineNo">173</span><a name="line.173"></a>
-<span class="sourceLineNo">174</span>            public void visitLeafNode(BSPTree&lt;Euclidean3D&gt; node) {<a name="line.174"></a>
+<span class="sourceLineNo">019</span>import java.io.IOException;<a name="line.19"></a>
+<span class="sourceLineNo">020</span>import java.io.InputStream;<a name="line.20"></a>
+<span class="sourceLineNo">021</span>import java.io.InputStreamReader;<a name="line.21"></a>
+<span class="sourceLineNo">022</span>import java.io.Reader;<a name="line.22"></a>
+<span class="sourceLineNo">023</span>import java.lang.reflect.Field;<a name="line.23"></a>
+<span class="sourceLineNo">024</span>import java.text.ParseException;<a name="line.24"></a>
+<span class="sourceLineNo">025</span>import java.util.ArrayList;<a name="line.25"></a>
+<span class="sourceLineNo">026</span>import java.util.Arrays;<a name="line.26"></a>
+<span class="sourceLineNo">027</span>import java.util.List;<a name="line.27"></a>
+<span class="sourceLineNo">028</span><a name="line.28"></a>
+<span class="sourceLineNo">029</span>import org.apache.commons.math3.exception.MathArithmeticException;<a name="line.29"></a>
+<span class="sourceLineNo">030</span>import org.apache.commons.math3.exception.MathIllegalArgumentException;<a name="line.30"></a>
+<span class="sourceLineNo">031</span>import org.apache.commons.math3.exception.util.ExceptionContext;<a name="line.31"></a>
+<span class="sourceLineNo">032</span>import org.apache.commons.math3.exception.util.Localizable;<a name="line.32"></a>
+<span class="sourceLineNo">033</span>import org.apache.commons.math3.exception.util.LocalizedFormats;<a name="line.33"></a>
+<span class="sourceLineNo">034</span>import org.apache.commons.math3.geometry.Vector;<a name="line.34"></a>
+<span class="sourceLineNo">035</span>import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;<a name="line.35"></a>
+<span class="sourceLineNo">036</span>import org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet;<a name="line.36"></a>
+<span class="sourceLineNo">037</span>import org.apache.commons.math3.geometry.euclidean.twod.SubLine;<a name="line.37"></a>
+<span class="sourceLineNo">038</span>import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;<a name="line.38"></a>
+<span class="sourceLineNo">039</span>import org.apache.commons.math3.geometry.partitioning.BSPTree;<a name="line.39"></a>
+<span class="sourceLineNo">040</span>import org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor;<a name="line.40"></a>
+<span class="sourceLineNo">041</span>import org.apache.commons.math3.geometry.partitioning.BoundaryAttribute;<a name="line.41"></a>
+<span class="sourceLineNo">042</span>import org.apache.commons.math3.geometry.partitioning.Region;<a name="line.42"></a>
+<span class="sourceLineNo">043</span>import org.apache.commons.math3.geometry.partitioning.RegionDumper;<a name="line.43"></a>
+<span class="sourceLineNo">044</span>import org.apache.commons.math3.geometry.partitioning.RegionFactory;<a name="line.44"></a>
+<span class="sourceLineNo">045</span>import org.apache.commons.math3.geometry.partitioning.RegionParser;<a name="line.45"></a>
+<span class="sourceLineNo">046</span>import org.apache.commons.math3.geometry.partitioning.SubHyperplane;<a name="line.46"></a>
+<span class="sourceLineNo">047</span>import org.apache.commons.math3.random.RandomGenerator;<a name="line.47"></a>
+<span class="sourceLineNo">048</span>import org.apache.commons.math3.random.Well1024a;<a name="line.48"></a>
+<span class="sourceLineNo">049</span>import org.apache.commons.math3.util.FastMath;<a name="line.49"></a>
+<span class="sourceLineNo">050</span>import org.junit.Assert;<a name="line.50"></a>
+<span class="sourceLineNo">051</span>import org.junit.Test;<a name="line.51"></a>
+<span class="sourceLineNo">052</span><a name="line.52"></a>
+<span class="sourceLineNo">053</span>public class PolyhedronsSetTest {<a name="line.53"></a>
+<span class="sourceLineNo">054</span><a name="line.54"></a>
+<span class="sourceLineNo">055</span>    @Test<a name="line.55"></a>
+<span class="sourceLineNo">056</span>    public void testBox() {<a name="line.56"></a>
+<span class="sourceLineNo">057</span>        PolyhedronsSet tree = new PolyhedronsSet(0, 1, 0, 1, 0, 1, 1.0e-10);<a name="line.57"></a>
+<span class="sourceLineNo">058</span>        Assert.assertEquals(1.0, tree.getSize(), 1.0e-10);<a name="line.58"></a>
+<span class="sourceLineNo">059</span>        Assert.assertEquals(6.0, tree.getBoundarySize(), 1.0e-10);<a name="line.59"></a>
+<span class="sourceLineNo">060</span>        Vector3D barycenter = (Vector3D) tree.getBarycenter();<a name="line.60"></a>
+<span class="sourceLineNo">061</span>        Assert.assertEquals(0.5, barycenter.getX(), 1.0e-10);<a name="line.61"></a>
+<span class="sourceLineNo">062</span>        Assert.assertEquals(0.5, barycenter.getY(), 1.0e-10);<a name="line.62"></a>
+<span class="sourceLineNo">063</span>        Assert.assertEquals(0.5, barycenter.getZ(), 1.0e-10);<a name="line.63"></a>
+<span class="sourceLineNo">064</span>        for (double x = -0.25; x &lt; 1.25; x += 0.1) {<a name="line.64"></a>
+<span class="sourceLineNo">065</span>            boolean xOK = (x &gt;= 0.0) &amp;&amp; (x &lt;= 1.0);<a name="line.65"></a>
+<span class="sourceLineNo">066</span>            for (double y = -0.25; y &lt; 1.25; y += 0.1) {<a name="line.66"></a>
+<span class="sourceLineNo">067</span>                boolean yOK = (y &gt;= 0.0) &amp;&amp; (y &lt;= 1.0);<a name="line.67"></a>
+<span class="sourceLineNo">068</span>                for (double z = -0.25; z &lt; 1.25; z += 0.1) {<a name="line.68"></a>
+<span class="sourceLineNo">069</span>                    boolean zOK = (z &gt;= 0.0) &amp;&amp; (z &lt;= 1.0);<a name="line.69"></a>
+<span class="sourceLineNo">070</span>                    Region.Location expected =<a name="line.70"></a>
+<span class="sourceLineNo">071</span>                        (xOK &amp;&amp; yOK &amp;&amp; zOK) ? Region.Location.INSIDE : Region.Location.OUTSIDE;<a name="line.71"></a>
+<span class="sourceLineNo">072</span>                    Assert.assertEquals(expected, tree.checkPoint(new Vector3D(x, y, z)));<a name="line.72"></a>
+<span class="sourceLineNo">073</span>                }<a name="line.73"></a>
+<span class="sourceLineNo">074</span>            }<a name="line.74"></a>
+<span class="sourceLineNo">075</span>        }<a name="line.75"></a>
+<span class="sourceLineNo">076</span>        checkPoints(Region.Location.BOUNDARY, tree, new Vector3D[] {<a name="line.76"></a>
+<span class="sourceLineNo">077</span>            new Vector3D(0.0, 0.5, 0.5),<a name="line.77"></a>
+<span class="sourceLineNo">078</span>            new Vector3D(1.0, 0.5, 0.5),<a name="line.78"></a>
+<span class="sourceLineNo">079</span>            new Vector3D(0.5, 0.0, 0.5),<a name="line.79"></a>
+<span class="sourceLineNo">080</span>            new Vector3D(0.5, 1.0, 0.5),<a name="line.80"></a>
+<span class="sourceLineNo">081</span>            new Vector3D(0.5, 0.5, 0.0),<a name="line.81"></a>
+<span class="sourceLineNo">082</span>            new Vector3D(0.5, 0.5, 1.0)<a name="line.82"></a>
+<span class="sourceLineNo">083</span>        });<a name="line.83"></a>
+<span class="sourceLineNo">084</span>        checkPoints(Region.Location.OUTSIDE, tree, new Vector3D[] {<a name="line.84"></a>
+<span class="sourceLineNo">085</span>            new Vector3D(0.0, 1.2, 1.2),<a name="line.85"></a>
+<span class="sourceLineNo">086</span>            new Vector3D(1.0, 1.2, 1.2),<a name="line.86"></a>
+<span class="sourceLineNo">087</span>            new Vector3D(1.2, 0.0, 1.2),<a name="line.87"></a>
+<span class="sourceLineNo">088</span>            new Vector3D(1.2, 1.0, 1.2),<a name="line.88"></a>
+<span class="sourceLineNo">089</span>            new Vector3D(1.2, 1.2, 0.0),<a name="line.89"></a>
+<span class="sourceLineNo">090</span>            new Vector3D(1.2, 1.2, 1.0)<a name="line.90"></a>
+<span class="sourceLineNo">091</span>        });<a name="line.91"></a>
+<span class="sourceLineNo">092</span>    }<a name="line.92"></a>
+<span class="sourceLineNo">093</span><a name="line.93"></a>
+<span class="sourceLineNo">094</span>    @Test<a name="line.94"></a>
+<span class="sourceLineNo">095</span>    public void testTetrahedron() throws MathArithmeticException {<a name="line.95"></a>
+<span class="sourceLineNo">096</span>        Vector3D vertex1 = new Vector3D(1, 2, 3);<a name="line.96"></a>
+<span class="sourceLineNo">097</span>        Vector3D vertex2 = new Vector3D(2, 2, 4);<a name="line.97"></a>
+<span class="sourceLineNo">098</span>        Vector3D vertex3 = new Vector3D(2, 3, 3);<a name="line.98"></a>
+<span class="sourceLineNo">099</span>        Vector3D vertex4 = new Vector3D(1, 3, 4);<a name="line.99"></a>
+<span class="sourceLineNo">100</span>        @SuppressWarnings("unchecked")<a name="line.100"></a>
+<span class="sourceLineNo">101</span>        PolyhedronsSet tree =<a name="line.101"></a>
+<span class="sourceLineNo">102</span>            (PolyhedronsSet) new RegionFactory&lt;Euclidean3D&gt;().buildConvex(<a name="line.102"></a>
+<span class="sourceLineNo">103</span>                new Plane(vertex3, vertex2, vertex1, 1.0e-10),<a name="line.103"></a>
+<span class="sourceLineNo">104</span>                new Plane(vertex2, vertex3, vertex4, 1.0e-10),<a name="line.104"></a>
+<span class="sourceLineNo">105</span>                new Plane(vertex4, vertex3, vertex1, 1.0e-10),<a name="line.105"></a>
+<span class="sourceLineNo">106</span>                new Plane(vertex1, vertex2, vertex4, 1.0e-10));<a name="line.106"></a>
+<span class="sourceLineNo">107</span>        Assert.assertEquals(1.0 / 3.0, tree.getSize(), 1.0e-10);<a name="line.107"></a>
+<span class="sourceLineNo">108</span>        Assert.assertEquals(2.0 * FastMath.sqrt(3.0), tree.getBoundarySize(), 1.0e-10);<a name="line.108"></a>
+<span class="sourceLineNo">109</span>        Vector3D barycenter = (Vector3D) tree.getBarycenter();<a name="line.109"></a>
+<span class="sourceLineNo">110</span>        Assert.assertEquals(1.5, barycenter.getX(), 1.0e-10);<a name="line.110"></a>
+<span class="sourceLineNo">111</span>        Assert.assertEquals(2.5, barycenter.getY(), 1.0e-10);<a name="line.111"></a>
+<span class="sourceLineNo">112</span>        Assert.assertEquals(3.5, barycenter.getZ(), 1.0e-10);<a name="line.112"></a>
+<span class="sourceLineNo">113</span>        double third = 1.0 / 3.0;<a name="line.113"></a>
+<span class="sourceLineNo">114</span>        checkPoints(Region.Location.BOUNDARY, tree, new Vector3D[] {<a name="line.114"></a>
+<span class="sourceLineNo">115</span>            vertex1, vertex2, vertex3, vertex4,<a name="line.115"></a>
+<span class="sourceLineNo">116</span>            new Vector3D(third, vertex1, third, vertex2, third, vertex3),<a name="line.116"></a>
+<span class="sourceLineNo">117</span>            new Vector3D(third, vertex2, third, vertex3, third, vertex4),<a name="line.117"></a>
+<span class="sourceLineNo">118</span>            new Vector3D(third, vertex3, third, vertex4, third, vertex1),<a name="line.118"></a>
+<span class="sourceLineNo">119</span>            new Vector3D(third, vertex4, third, vertex1, third, vertex2)<a name="line.119"></a>
+<span class="sourceLineNo">120</span>        });<a name="line.120"></a>
+<span class="sourceLineNo">121</span>        checkPoints(Region.Location.OUTSIDE, tree, new Vector3D[] {<a name="line.121"></a>
+<span class="sourceLineNo">122</span>            new Vector3D(1, 2, 4),<a name="line.122"></a>
+<span class="sourceLineNo">123</span>            new Vector3D(2, 2, 3),<a name="line.123"></a>
+<span class="sourceLineNo">124</span>            new Vector3D(2, 3, 4),<a name="line.124"></a>
+<span class="sourceLineNo">125</span>            new Vector3D(1, 3, 3)<a name="line.125"></a>
+<span class="sourceLineNo">126</span>        });<a name="line.126"></a>
+<span class="sourceLineNo">127</span>    }<a name="line.127"></a>
+<span class="sourceLineNo">128</span><a name="line.128"></a>
+<span class="sourceLineNo">129</span>    @Test<a name="line.129"></a>
+<span class="sourceLineNo">130</span>    public void testIsometry() throws MathArithmeticException, MathIllegalArgumentException {<a name="line.130"></a>
+<span class="sourceLineNo">131</span>        Vector3D vertex1 = new Vector3D(1.1, 2.2, 3.3);<a name="line.131"></a>
+<span class="sourceLineNo">132</span>        Vector3D vertex2 = new Vector3D(2.0, 2.4, 4.2);<a name="line.132"></a>
+<span class="sourceLineNo">133</span>        Vector3D vertex3 = new Vector3D(2.8, 3.3, 3.7);<a name="line.133"></a>
+<span class="sourceLineNo">134</span>        Vector3D vertex4 = new Vector3D(1.0, 3.6, 4.5);<a name="line.134"></a>
+<span class="sourceLineNo">135</span>        @SuppressWarnings("unchecked")<a name="line.135"></a>
+<span class="sourceLineNo">136</span>        PolyhedronsSet tree =<a name="line.136"></a>
+<span class="sourceLineNo">137</span>            (PolyhedronsSet) new RegionFactory&lt;Euclidean3D&gt;().buildConvex(<a name="line.137"></a>
+<span class="sourceLineNo">138</span>                new Plane(vertex3, vertex2, vertex1, 1.0e-10),<a name="line.138"></a>
+<span class="sourceLineNo">139</span>                new Plane(vertex2, vertex3, vertex4, 1.0e-10),<a name="line.139"></a>
+<span class="sourceLineNo">140</span>                new Plane(vertex4, vertex3, vertex1, 1.0e-10),<a name="line.140"></a>
+<span class="sourceLineNo">141</span>                new Plane(vertex1, vertex2, vertex4, 1.0e-10));<a name="line.141"></a>
+<span class="sourceLineNo">142</span>        Vector3D barycenter = (Vector3D) tree.getBarycenter();<a name="line.142"></a>
+<span class="sourceLineNo">143</span>        Vector3D s = new Vector3D(10.2, 4.3, -6.7);<a name="line.143"></a>
+<span class="sourceLineNo">144</span>        Vector3D c = new Vector3D(-0.2, 2.1, -3.2);<a name="line.144"></a>
+<span class="sourceLineNo">145</span>        Rotation r = new Rotation(new Vector3D(6.2, -4.4, 2.1), 0.12);<a name="line.145"></a>
+<span class="sourceLineNo">146</span><a name="line.146"></a>
+<span class="sourceLineNo">147</span>        tree = tree.rotate(c, r).translate(s);<a name="line.147"></a>
+<span class="sourceLineNo">148</span><a name="line.148"></a>
+<span class="sourceLineNo">149</span>        Vector3D newB =<a name="line.149"></a>
+<span class="sourceLineNo">150</span>            new Vector3D(1.0, s,<a name="line.150"></a>
+<span class="sourceLineNo">151</span>                         1.0, c,<a name="line.151"></a>
+<span class="sourceLineNo">152</span>                         1.0, r.applyTo(barycenter.subtract(c)));<a name="line.152"></a>
+<span class="sourceLineNo">153</span>        Assert.assertEquals(0.0,<a name="line.153"></a>
+<span class="sourceLineNo">154</span>                            newB.subtract((Vector&lt;Euclidean3D&gt;) tree.getBarycenter()).getNorm(),<a name="line.154"></a>
+<span class="sourceLineNo">155</span>                            1.0e-10);<a name="line.155"></a>
+<span class="sourceLineNo">156</span><a name="line.156"></a>
+<span class="sourceLineNo">157</span>        final Vector3D[] expectedV = new Vector3D[] {<a name="line.157"></a>
+<span class="sourceLineNo">158</span>            new Vector3D(1.0, s,<a name="line.158"></a>
+<span class="sourceLineNo">159</span>                         1.0, c,<a name="line.159"></a>
+<span class="sourceLineNo">160</span>                         1.0, r.applyTo(vertex1.subtract(c))),<a name="line.160"></a>
+<span class="sourceLineNo">161</span>                         new Vector3D(1.0, s,<a name="line.161"></a>
+<span class="sourceLineNo">162</span>                                      1.0, c,<a name="line.162"></a>
+<span class="sourceLineNo">163</span>                                      1.0, r.applyTo(vertex2.subtract(c))),<a name="line.163"></a>
+<span class="sourceLineNo">164</span>                                      new Vector3D(1.0, s,<a name="line.164"></a>
+<span class="sourceLineNo">165</span>                                                   1.0, c,<a name="line.165"></a>
+<span class="sourceLineNo">166</span>                                                   1.0, r.applyTo(vertex3.subtract(c))),<a name="line.166"></a>
+<span class="sourceLineNo">167</span>                                                   new Vector3D(1.0, s,<a name="line.167"></a>
+<span class="sourceLineNo">168</span>                                                                1.0, c,<a name="line.168"></a>
+<span class="sourceLineNo">169</span>                                                                1.0, r.applyTo(vertex4.subtract(c)))<a name="line.169"></a>
+<span class="sourceLineNo">170</span>        };<a name="line.170"></a>
+<span class="sourceLineNo">171</span>        tree.getTree(true).visit(new BSPTreeVisitor&lt;Euclidean3D&gt;() {<a name="line.171"></a>
+<span class="sourceLineNo">172</span><a name="line.172"></a>
+<span class="sourceLineNo">173</span>            public Order visitOrder(BSPTree&lt;Euclidean3D&gt; node) {<a name="line.173"></a>
+<span class="sourceLineNo">174</span>                return Order.MINUS_SUB_PLUS;<a name="line.174"></a>
 <span class="sourceLineNo">175</span>            }<a name="line.175"></a>
 <span class="sourceLineNo">176</span><a name="line.176"></a>
-<span class="sourceLineNo">177</span>            private void checkFacet(SubPlane facet) {<a name="line.177"></a>
-<span class="sourceLineNo">178</span>                Plane plane = (Plane) facet.getHyperplane();<a name="line.178"></a>
-<span class="sourceLineNo">179</span>                Vector2D[][] vertices =<a name="line.179"></a>
-<span class="sourceLineNo">180</span>                    ((PolygonsSet) facet.getRemainingRegion()).getVertices();<a name="line.180"></a>
-<span class="sourceLineNo">181</span>                Assert.assertEquals(1, vertices.length);<a name="line.181"></a>
-<span class="sourceLineNo">182</span>                for (int i = 0; i &lt; vertices[0].length; ++i) {<a name="line.182"></a>
-<span class="sourceLineNo">183</span>                    Vector3D v = plane.toSpace(vertices[0][i]);<a name="line.183"></a>
-<span class="sourceLineNo">184</span>                    double d = Double.POSITIVE_INFINITY;<a name="line.184"></a>
-<span class="sourceLineNo">185</span>                    for (int k = 0; k &lt; expectedV.length; ++k) {<a name="line.185"></a>
-<span class="sourceLineNo">186</span>                        d = FastMath.min(d, v.subtract(expectedV[k]).getNorm());<a name="line.186"></a>
-<span class="sourceLineNo">187</span>                    }<a name="line.187"></a>
-<span class="sourceLineNo">188</span>                    Assert.assertEquals(0, d, 1.0e-10);<a name="line.188"></a>
-<span class="sourceLineNo">189</span>                }<a name="line.189"></a>
+<span class="sourceLineNo">177</span>            public void visitInternalNode(BSPTree&lt;Euclidean3D&gt; node) {<a name="line.177"></a>
+<span class="sourceLineNo">178</span>                @SuppressWarnings("unchecked")<a name="line.178"></a>
+<span class="sourceLineNo">179</span>                BoundaryAttribute&lt;Euclidean3D&gt; attribute =<a name="line.179"></a>
+<span class="sourceLineNo">180</span>                    (BoundaryAttribute&lt;Euclidean3D&gt;) node.getAttribute();<a name="line.180"></a>
+<span class="sourceLineNo">181</span>                if (attribute.getPlusOutside() != null) {<a name="line.181"></a>
+<span class="sourceLineNo">182</span>                    checkFacet((SubPlane) attribute.getPlusOutside());<a name="line.182"></a>
+<span class="sourceLineNo">183</span>                }<a name="line.183"></a>
+<span class="sourceLineNo">184</span>                if (attribute.getPlusInside() != null) {<a name="line.184"></a>
+<span class="sourceLineNo">185</span>                    checkFacet((SubPlane) attribute.getPlusInside());<a name="line.185"></a>
+<span class="sourceLineNo">186</span>                }<a name="line.186"></a>
+<span class="sourceLineNo">187</span>            }<a name="line.187"></a>
+<span class="sourceLineNo">188</span><a name="line.188"></a>
+<span class="sourceLineNo">189</span>            public void visitLeafNode(BSPTree&lt;Euclidean3D&gt; node) {<a name="line.189"></a>
 <span class="sourceLineNo">190</span>            }<a name="line.190"></a>
 <span class="sourceLineNo">191</span><a name="line.191"></a>
-<span class="sourceLineNo">192</span>        });<a name="line.192"></a>
-<span class="sourceLineNo">193</span><a name="line.193"></a>
-<span class="sourceLineNo">194</span>    }<a name="line.194"></a>
-<span class="sourceLineNo">195</span><a name="line.195"></a>
-<span class="sourceLineNo">196</span>    @Test<a name="line.196"></a>
-<span class="sourceLineNo">197</span>    public void testBuildBox() {<a name="line.197"></a>
-<span class="sourceLineNo">198</span>        double x = 1.0;<a name="line.198"></a>
-<span class="sourceLineNo">199</span>        double y = 2.0;<a name="line.199"></a>
-<span class="sourceLineNo">200</span>        double z = 3.0;<a name="line.200"></a>
-<span class="sourceLineNo">201</span>        double w = 0.1;<a name="line.201"></a>
-<span class="sourceLineNo">202</span>        double l = 1.0;<a name="line.202"></a>
-<span class="sourceLineNo">203</span>        PolyhedronsSet tree =<a name="line.203"></a>
-<span class="sourceLineNo">204</span>            new PolyhedronsSet(x - l, x + l, y - w, y + w, z - w, z + w, 1.0e-10);<a name="line.204"></a>
-<span class="sourceLineNo">205</span>        Vector3D barycenter = (Vector3D) tree.getBarycenter();<a name="line.205"></a>
-<span class="sourceLineNo">206</span>        Assert.assertEquals(x, barycenter.getX(), 1.0e-10);<a name="line.206"></a>
-<span class="sourceLineNo">207</span>        Assert.assertEquals(y, barycenter.getY(), 1.0e-10);<a name="line.207"></a>
-<span class="sourceLineNo">208</span>        Assert.assertEquals(z, barycenter.getZ(), 1.0e-10);<a name="line.208"></a>
-<span class="sourceLineNo">209</span>        Assert.assertEquals(8 * l * w * w, tree.getSize(), 1.0e-10);<a name="line.209"></a>
-<span class="sourceLineNo">210</span>        Assert.assertEquals(8 * w * (2 * l + w), tree.getBoundarySize(), 1.0e-10);<a name="line.210"></a>
-<span class="sourceLineNo">211</span>    }<a name="line.211"></a>
-<span class="sourceLineNo">212</span><a name="line.212"></a>
-<span class="sourceLineNo">213</span>    @Test<a name="line.213"></a>
-<span class="sourceLineNo">214</span>    public void testCross() {<a name="line.214"></a>
-<span class="sourceLineNo">215</span><a name="line.215"></a>
-<span class="sourceLineNo">216</span>        double x = 1.0;<a name="line.216"></a>
-<span class="sourceLineNo">217</span>        double y = 2.0;<a name="line.217"></a>
-<span class="sourceLineNo">218</span>        double z = 3.0;<a name="line.218"></a>
-<span class="sourceLineNo">219</span>        double w = 0.1;<a name="line.219"></a>
-<span class="sourceLineNo">220</span>        double l = 1.0;<a name="line.220"></a>
-<span class="sourceLineNo">221</span>        PolyhedronsSet xBeam =<a name="line.221"></a>
-<span class="sourceLineNo">222</span>            new PolyhedronsSet(x - l, x + l, y - w, y + w, z - w, z + w, 1.0e-10);<a name="line.222"></a>
-<span class="sourceLineNo">223</span>        PolyhedronsSet yBeam =<a name="line.223"></a>
-<span class="sourceLineNo">224</span>            new PolyhedronsSet(x - w, x + w, y - l, y + l, z - w, z + w, 1.0e-10);<a name="line.224"></a>
-<span class="sourceLineNo">225</span>        PolyhedronsSet zBeam =<a name="line.225"></a>
-<span class="sourceLineNo">226</span>            new PolyhedronsSet(x - w, x + w, y - w, y + w, z - l, z + l, 1.0e-10);<a name="line.226"></a>
-<span class="sourceLineNo">227</span>        RegionFactory&lt;Euclidean3D&gt; factory = new RegionFactory&lt;Euclidean3D&gt;();<a name="line.227"></a>
-<span class="sourceLineNo">228</span>        PolyhedronsSet tree = (PolyhedronsSet) factory.union(xBeam, factory.union(yBeam, zBeam));<a name="line.228"></a>
-<span class="sourceLineNo">229</span>        Vector3D barycenter = (Vector3D) tree.getBarycenter();<a name="line.229"></a>
+<span class="sourceLineNo">192</span>            private void checkFacet(SubPlane facet) {<a name="line.192"></a>
+<span class="sourceLineNo">193</span>                Plane plane = (Plane) facet.getHyperplane();<a name="line.193"></a>
+<span class="sourceLineNo">194</span>                Vector2D[][] vertices =<a name="line.194"></a>
+<span class="sourceLineNo">195</span>                    ((PolygonsSet) facet.getRemainingRegion()).getVertices();<a name="line.195"></a>
+<span class="sourceLineNo">196</span>                Assert.assertEquals(1, vertices.length);<a name="line.196"></a>
+<span class="sourceLineNo">197</span>                for (int i = 0; i &lt; vertices[0].length; ++i) {<a name="line.197"></a>
+<span class="sourceLineNo">198</span>                    Vector3D v = plane.toSpace(vertices[0][i]);<a name="line.198"></a>
+<span class="sourceLineNo">199</span>                    double d = Double.POSITIVE_INFINITY;<a name="line.199"></a>
+<span class="sourceLineNo">200</span>                    for (int k = 0; k &lt; expectedV.length; ++k) {<a name="line.200"></a>
+<span class="sourceLineNo">201</span>                        d = FastMath.min(d, v.subtract(expectedV[k]).getNorm());<a name="line.201"></a>
+<span class="sourceLineNo">202</span>                    }<a name="line.202"></a>
+<span class="sourceLineNo">203</span>                    Assert.assertEquals(0, d, 1.0e-10);<a name="line.203"></a>
+<span class="sourceLineNo">204</span>                }<a name="line.204"></a>
+<span class="sourceLineNo">205</span>            }<a name="line.205"></a>
+<span class="sourceLineNo">206</span><a name="line.206"></a>
+<span class="sourceLineNo">207</span>        });<a name="line.207"></a>
+<span class="sourceLineNo">208</span><a name="line.208"></a>
+<span class="sourceLineNo">209</span>    }<a name="line.209"></a>
+<span class="sourceLineNo">210</span><a name="line.210"></a>
+<span class="sourceLineNo">211</span>    @Test<a name="line.211"></a>
+<span class="sourceLineNo">212</span>    public void testBuildBox() {<a name="line.212"></a>
+<span class="sourceLineNo">213</span>        double x = 1.0;<a name="line.213"></a>
+<span class="sourceLineNo">214</span>        double y = 2.0;<a name="line.214"></a>
+<span class="sourceLineNo">215</span>        double z = 3.0;<a name="line.215"></a>
+<span class="sourceLineNo">216</span>        double w = 0.1;<a name="line.216"></a>
+<span class="sourceLineNo">217</span>        double l = 1.0;<a name="line.217"></a>
+<span class="sourceLineNo">218</span>        PolyhedronsSet tree =<a name="line.218"></a>
+<span class="sourceLineNo">219</span>            new PolyhedronsSet(x - l, x + l, y - w, y + w, z - w, z + w, 1.0e-10);<a name="line.219"></a>
+<span class="sourceLineNo">220</span>        Vector3D barycenter = (Vector3D) tree.getBarycenter();<a name="line.220"></a>
+<span class="sourceLineNo">221</span>        Assert.assertEquals(x, barycenter.getX(), 1.0e-10);<a name="line.221"></a>
+<span class="sourceLineNo">222</span>        Assert.assertEquals(y, barycenter.getY(), 1.0e-10);<a name="line.222"></a>
+<span class="sourceLineNo">223</span>        Assert.assertEquals(z, barycenter.getZ(), 1.0e-10);<a name="line.223"></a>
+<span class="sourceLineNo">224</span>        Assert.assertEquals(8 * l * w * w, tree.getSize(), 1.0e-10);<a name="line.224"></a>
+<span class="sourceLineNo">225</span>        Assert.assertEquals(8 * w * (2 * l + w), tree.getBoundarySize(), 1.0e-10);<a name="line.225"></a>
+<span class="sourceLineNo">226</span>    }<a name="line.226"></a>
+<span class="sourceLineNo">227</span><a name="line.227"></a>
+<span class="sourceLineNo">228</span>    @Test<a name="line.228"></a>
+<span class="sourceLineNo">229</span>    public void testCross() {<a name="line.229"></a>
 <span class="sourceLineNo">230</span><a name="line.230"></a>
-<span class="sourceLineNo">231</span>        Assert.assertEquals(x, barycenter.getX(), 1.0e-10);<a name="line.231"></a>
-<span class="sourceLineNo">232</span>        Assert.assertEquals(y, barycenter.getY(), 1.0e-10);<a name="line.232"></a>
-<span class="sourceLineNo">233</span>        Assert.assertEquals(z, barycenter.getZ(), 1.0e-10);<a name="line.233"></a>
-<span class="sourceLineNo">234</span>        Assert.assertEquals(8 * w * w * (3 * l - 2 * w), tree.getSize(), 1.0e-10);<a name="line.234"></a>
-<span class="sourceLineNo">235</span>        Assert.assertEquals(24 * w * (2 * l - w), tree.getBoundarySize(), 1.0e-10);<a name="line.235"></a>
-<span class="sourceLineNo">236</span><a name="line.236"></a>
-<span class="sourceLineNo">237</span>    }<a name="line.237"></a>
-<span class="sourceLineNo">238</span><a name="line.238"></a>
-<span class="sourceLineNo">239</span>    @Test<a name="line.239"></a>
-<span class="sourceLineNo">240</span>    public void testIssue780() throws MathArithmeticException {<a name="line.240"></a>
-<span class="sourceLineNo">241</span>        float[] coords = {<a name="line.241"></a>
-<span class="sourceLineNo">242</span>            1.000000f, -1.000000f, -1.000000f, <a name="line.242"></a>
-<span class="sourceLineNo">243</span>            1.000000f, -1.000000f, 1.000000f, <a name="line.243"></a>
-<span class="sourceLineNo">244</span>            -1.000000f, -1.000000f, 1.000000f, <a name="line.244"></a>
-<span class="sourceLineNo">245</span>            -1.000000f, -1.000000f, -1.000000f, <a name="line.245"></a>
-<span class="sourceLineNo">246</span>            1.000000f, 1.000000f, -1f, <a name="line.246"></a>
-<span class="sourceLineNo">247</span>            0.999999f, 1.000000f, 1.000000f,   // 1.000000f, 1.000000f, 1.000000f, <a name="line.247"></a>
-<span class="sourceLineNo">248</span>            -1.000000f, 1.000000f, 1.000000f, <a name="line.248"></a>
-<span class="sourceLineNo">249</span>            -1.000000f, 1.000000f, -1.000000f};<a name="line.249"></a>
-<span class="sourceLineNo">250</span>        int[] indices = {<a name="line.250"></a>
-<span class="sourceLineNo">251</span>            0, 1, 2, 0, 2, 3, <a name="line.251"></a>
-<span class="sourceLineNo">252</span>            4, 7, 6, 4, 6, 5, <a name="line.252"></a>
-<span class="sourceLineNo">253</span>            0, 4, 5, 0, 5, 1, <a name="line.253"></a>
-<span class="sourceLineNo">254</span>            1, 5, 6, 1, 6, 2, <a name="line.254"></a>
-<span class="sourceLineNo">255</span>            2, 6, 7, 2, 7, 3, <a name="line.255"></a>
-<span class="sourceLineNo">256</span>            4, 0, 3, 4, 3, 7};<a name="line.256"></a>
-<span class="sourceLineNo">257</span>        ArrayList&lt;SubHyperplane&lt;Euclidean3D&gt;&gt; subHyperplaneList = new ArrayList&lt;SubHyperplane&lt;Euclidean3D&gt;&gt;();<a name="line.257"></a>
-<span class="sourceLineNo">258</span>        for (int idx = 0; idx &lt; indices.length; idx += 3) {<a name="line.258"></a>
-<span class="sourceLineNo">259</span>            int idxA = indices[idx] * 3;<a name="line.259"></a>
-<span class="sourceLineNo">260</span>            int idxB = indices[idx + 1] * 3;<a name="line.260"></a>
-<span class="sourceLineNo">261</span>            int idxC = indices[idx + 2] * 3;<a name="line.261"></a>
-<span class="sourceLineNo">262</span>            Vector3D v_1 = new Vector3D(coords[idxA], coords[idxA + 1], coords[idxA + 2]);<a name="line.262"></a>
-<span class="sourceLineNo">263</span>            Vector3D v_2 = new Vector3D(coords[idxB], coords[idxB + 1], coords[idxB + 2]);<a name="line.263"></a>
-<span class="sourceLineNo">264</span>            Vector3D v_3 = new Vector3D(coords[idxC], coords[idxC + 1], coords[idxC + 2]);<a name="line.264"></a>
-<span class="sourceLineNo">265</span>            Vector3D[] vertices = {v_1, v_2, v_3};<a name="line.265"></a>
-<span class="sourceLineNo">266</span>            Plane polyPlane = new Plane(v_1, v_2, v_3, 1.0e-10);<a name="line.266"></a>
-<span class="sourceLineNo">267</span>            ArrayList&lt;SubHyperplane&lt;Euclidean2D&gt;&gt; lines = new ArrayList&lt;SubHyperplane&lt;Euclidean2D&gt;&gt;();<a name="line.267"></a>
-<span class="sourceLineNo">268</span><a name="line.268"></a>
-<span class="sourceLineNo">269</span>            Vector2D[] projPts = new Vector2D[vertices.length];<a name="line.269"></a>
-<span class="sourceLineNo">270</span>            for (int ptIdx = 0; ptIdx &lt; projPts.length; ptIdx++) {<a name="line.270"></a>
-<span class="sourceLineNo">271</span>                projPts[ptIdx] = polyPlane.toSubSpace(vertices[ptIdx]);<a name="line.271"></a>
-<span class="sourceLineNo">272</span>            }<a name="line.272"></a>
-<span class="sourceLineNo">273</span><a name="line.273"></a>
-<span class="sourceLineNo">274</span>            SubLine lineInPlane = null;<a name="line.274"></a>
-<span class="sourceLineNo">275</span>            for (int ptIdx = 0; ptIdx &lt; projPts.length; ptIdx++) {<a name="line.275"></a>
-<span class="sourceLineNo">276</span>                lineInPlane = new SubLine(projPts[ptIdx], projPts[(ptIdx + 1) % projPts.length], 1.0e-10);<a name="line.276"></a>
-<span class="sourceLineNo">277</span>                lines.add(lineInPlane);<a name="line.277"></a>
-<span class="sourceLineNo">278</span>            }<a name="line.278"></a>
-<span class="sourceLineNo">279</span>            Region&lt;Euclidean2D&gt; polyRegion = new PolygonsSet(lines, 1.0e-10);<a name="line.279"></a>
-<span class="sourceLineNo">280</span>            SubPlane polygon = new SubPlane(polyPlane, polyRegion);<a name="line.280"></a>
-<span class="sourceLineNo">281</span>            subHyperplaneList.add(polygon);<a name="line.281"></a>
-<span class="sourceLineNo">282</span>        }<a name="line.282"></a>
-<span class="sourceLineNo">283</span>        PolyhedronsSet polyhedronsSet = new PolyhedronsSet(subHyperplaneList, 1.0e-10);<a name="line.283"></a>
-<span class="sourceLineNo">284</span>        Assert.assertEquals( 8.0, polyhedronsSet.getSize(), 3.0e-6);<a name="line.284"></a>
-<span class="sourceLineNo">285</span>        Assert.assertEquals(24.0, polyhedronsSet.getBoundarySize(), 5.0e-6);<a name="line.285"></a>
-<span class="sourceLineNo">286</span>    }<a name="line.286"></a>
-<span class="sourceLineNo">287</span><a name="line.287"></a>
-<span class="sourceLineNo">288</span>    @Test<a name="line.288"></a>
-<span class="sourceLineNo">289</span>    public void testTooThinBox() {<a name="line.289"></a>
-<span class="sourceLineNo">290</span>        Assert.assertEquals(0.0,<a name="line.290"></a>
-<span class="sourceLineNo">291</span>                            new PolyhedronsSet(0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0e-10).getSize(),<a name="line.291"></a>
-<span class="sourceLineNo">292</span>                            1.0e-10);<a name="line.292"></a>
-<span class="sourceLineNo">293</span>    }<a name="line.293"></a>
-<span class="sourceLineNo">294</span><a name="line.294"></a>
-<span class="sourceLineNo">295</span>    @Test<a name="line.295"></a>
-<span class="sourceLineNo">296</span>    public void testWrongUsage() {<a name="line.296"></a>
-<span class="sourceLineNo">297</span>        // the following is a wrong usage of the constructor.<a name="line.297"></a>
-<span class="sourceLineNo">298</span>        // as explained in the javadoc, the failure is NOT detected at construction<a name="line.298"></a>
-<span class="sourceLineNo">299</span>        // time but occurs later on<a name="line.299"></a>
-<span class="sourceLineNo">300</span>        PolyhedronsSet ps = new PolyhedronsSet(new BSPTree&lt;Euclidean3D&gt;(), 1.0e-10);<a name="line.300"></a>
-<span class="sourceLineNo">301</span>        Assert.assertNotNull(ps);<a name="line.301"></a>
-<span class="sourceLineNo">302</span>        try {<a name="line.302"></a>
-<span class="sourceLineNo">303</span>            ps.checkPoint(Vector3D.ZERO);<a name="line.303"></a>
-<span class="sourceLineNo">304</span>            Assert.fail("an exception should have been thrown");<a name="line.304"></a>
-<span class="sourceLineNo">305</span>        } catch (NullPointerException npe) {<a name="line.305"></a>
-<span class="sourceLineNo">306</span>            // this is expected<a name="line.306"></a>
-<span class="sourceLineNo">307</span>        }<a name="line.307"></a>
+<span class="sourceLineNo">231</span>        double x = 1.0;<a name="line.231"></a>
+<span class="sourceLineNo">232</span>        double y = 2.0;<a name="line.232"></a>
+<span class="sourceLineNo">233</span>        double z = 3.0;<a name="line.233"></a>
+<span class="sourceLineNo">234</span>        double w = 0.1;<a name="line.234"></a>
+<span class="sourceLineNo">235</span>        double l = 1.0;<a name="line.235"></a>
+<span class="sourceLineNo">236</span>        PolyhedronsSet xBeam =<a name="line.236"></a>
+<span class="sourceLineNo">237</span>            new PolyhedronsSet(x - l, x + l, y - w, y + w, z - w, z + w, 1.0e-10);<a name="line.237"></a>
+<span class="sourceLineNo">238</span>        PolyhedronsSet yBeam =<a name="line.238"></a>
+<span class="sourceLineNo">239</span>            new PolyhedronsSet(x - w, x + w, y - l, y + l, z - w, z + w, 1.0e-10);<a name="line.239"></a>
+<span class="sourceLineNo">240</span>        PolyhedronsSet zBeam =<a name="line.240"></a>
+<span class="sourceLineNo">241</span>            new PolyhedronsSet(x - w, x + w, y - w, y + w, z - l, z + l, 1.0e-10);<a name="line.241"></a>
+<span class="sourceLineNo">242</span>        RegionFactory&lt;Euclidean3D&gt; factory = new RegionFactory&lt;Euclidean3D&gt;();<a name="line.242"></a>
+<span class="sourceLineNo">243</span>        PolyhedronsSet tree = (PolyhedronsSet) factory.union(xBeam, factory.union(yBeam, zBeam));<a name="line.243"></a>
+<span class="sourceLineNo">244</span>        Vector3D barycenter = (Vector3D) tree.getBarycenter();<a name="line.244"></a>
+<span class="sourceLineNo">245</span><a name="line.245"></a>
+<span class="sourceLineNo">246</span>        Assert.assertEquals(x, barycenter.getX(), 1.0e-10);<a name="line.246"></a>
+<span class="sourceLineNo">247</span>        Assert.assertEquals(y, barycenter.getY(), 1.0e-10);<a name="line.247"></a>
+<span class="sourceLineNo">248</span>        Assert.assertEquals(z, barycenter.getZ(), 1.0e-10);<a name="line.248"></a>
+<span class="sourceLineNo">249</span>        Assert.assertEquals(8 * w * w * (3 * l - 2 * w), tree.getSize(), 1.0e-10);<a name="line.249"></a>
+<span class="sourceLineNo">250</span>        Assert.assertEquals(24 * w * (2 * l - w), tree.getBoundarySize(), 1.0e-10);<a name="line.250"></a>
+<span class="sourceLineNo">251</span><a name="line.251"></a>
+<span class="sourceLineNo">252</span>    }<a name="line.252"></a>
+<span class="sourceLineNo">253</span><a name="line.253"></a>
+<span class="sourceLineNo">254</span>    @Test<a name="line.254"></a>
+<span class="sourceLineNo">255</span>    public void testIssue780() throws MathArithmeticException {<a name="line.255"></a>
+<span class="sourceLineNo">256</span>        float[] coords = {<a name="line.256"></a>
+<span class="sourceLineNo">257</span>            1.000000f, -1.000000f, -1.000000f, <a name="line.257"></a>
+<span class="sourceLineNo">258</span>            1.000000f, -1.000000f, 1.000000f, <a name="line.258"></a>
+<span class="sourceLineNo">259</span>            -1.000000f, -1.000000f, 1.000000f, <a name="line.259"></a>
+<span class="sourceLineNo">260</span>            -1.000000f, -1.000000f, -1.000000f, <a name="line.260"></a>
+<span class="sourceLineNo">261</span>            1.000000f, 1.000000f, -1f, <a name="line.261"></a>
+<span class="sourceLineNo">262</span>            0.999999f, 1.000000f, 1.000000f,   // 1.000000f, 1.000000f, 1.000000f, <a name="line.262"></a>
+<span class="sourceLineNo">263</span>            -1.000000f, 1.000000f, 1.000000f, <a name="line.263"></a>
+<span class="sourceLineNo">264</span>            -1.000000f, 1.000000f, -1.000000f};<a name="line.264"></a>
+<span class="sourceLineNo">265</span>        int[] indices = {<a name="line.265"></a>
+<span class="sourceLineNo">266</span>            0, 1, 2, 0, 2, 3, <a name="line.266"></a>
+<span class="sourceLineNo">267</span>            4, 7, 6, 4, 6, 5, <a name="line.267"></a>
+<span class="sourceLineNo">268</span>            0, 4, 5, 0, 5, 1, <a name="line.268"></a>
+<span class="sourceLineNo">269</span>            1, 5, 6, 1, 6, 2, <a name="line.269"></a>
+<span class="sourceLineNo">270</span>            2, 6, 7, 2, 7, 3, <a name="line.270"></a>
+<span class="sourceLineNo">271</span>            4, 0, 3, 4, 3, 7};<a name="line.271"></a>
+<span class="sourceLineNo">272</span>        ArrayList&lt;SubHyperplane&lt;Euclidean3D&gt;&gt; subHyperplaneList = new ArrayList&lt;SubHyperplane&lt;Euclidean3D&gt;&gt;();<a name="line.272"></a>
+<span class="sourceLineNo">273</span>        for (int idx = 0; idx &lt; indices.length; idx += 3) {<a name="line.273"></a>
+<span class="sourceLineNo">274</span>            int idxA = indices[idx] * 3;<a name="line.274"></a>
+<span class="sourceLineNo">275</span>            int idxB = indices[idx + 1] * 3;<a name="line.275"></a>
+<span class="sourceLineNo">276</span>            int idxC = indices[idx + 2] * 3;<a name="line.276"></a>
+<span class="sourceLineNo">277</span>            Vector3D v_1 = new Vector3D(coords[idxA], coords[idxA + 1], coords[idxA + 2]);<a name="line.277"></a>
+<span class="sourceLineNo">278</span>            Vector3D v_2 = new Vector3D(coords[idxB], coords[idxB + 1], coords[idxB + 2]);<a name="line.278"></a>
+<span class="sourceLineNo">279</span>            Vector3D v_3 = new Vector3D(coords[idxC], coords[idxC + 1], coords[idxC + 2]);<a name="line.279"></a>
+<span class="sourceLineNo">280</span>            Vector3D[] vertices = {v_1, v_2, v_3};<a name="line.280"></a>
+<span class="sourceLineNo">281</span>            Plane polyPlane = new Plane(v_1, v_2, v_3, 1.0e-10);<a name="line.281"></a>
+<span class="sourceLineNo">282</span>            ArrayList&lt;SubHyperplane&lt;Euclidean2D&gt;&gt; lines = new ArrayList&lt;SubHyperplane&lt;Euclidean2D&gt;&gt;();<a name="line.282"></a>
+<span class="sourceLineNo">283</span><a name="line.283"></a>
+<span class="sourceLineNo">284</span>            Vector2D[] projPts = new Vector2D[vertices.length];<a name="line.284"></a>
+<span class="sourceLineNo">285</span>            for (int ptIdx = 0; ptIdx &lt; projPts.length; ptIdx++) {<a name="line.285"></a>
+<span class="sourceLineNo">286</span>                projPts[ptIdx] = polyPlane.toSubSpace(vertices[ptIdx]);<a name="line.286"></a>
+<span class="sourceLineNo">287</span>            }<a name="line.287"></a>
+<span class="sourceLineNo">288</span><a name="line.288"></a>
+<span class="sourceLineNo">289</span>            SubLine lineInPlane = null;<a name="line.289"></a>
+<span class="sourceLineNo">290</span>            for (int ptIdx = 0; ptIdx &lt; projPts.length; ptIdx++) {<a name="line.290"></a>
+<span class="sourceLineNo">291</span>                lineInPlane = new SubLine(projPts[ptIdx], projPts[(ptIdx + 1) % projPts.length], 1.0e-10);<a name="line.291"></a>
+<span class="sourceLineNo">292</span>                lines.add(lineInPlane);<a name="line.292"></a>
+<span class="sourceLineNo">293</span>            }<a name="line.293"></a>
+<span class="sourceLineNo">294</span>            Region&lt;Euclidean2D&gt; polyRegion = new PolygonsSet(lines, 1.0e-10);<a name="line.294"></a>
+<span class="sourceLineNo">295</span>            SubPlane polygon = new SubPlane(polyPlane, polyRegion);<a name="line.295"></a>
+<span class="sourceLineNo">296</span>            subHyperplaneList.add(polygon);<a name="line.296"></a>
+<span class="sourceLineNo">297</span>        }<a name="line.297"></a>
+<span class="sourceLineNo">298</span>        PolyhedronsSet polyhedronsSet = new PolyhedronsSet(subHyperplaneList, 1.0e-10);<a name="line.298"></a>
+<span class="sourceLineNo">299</span>        Assert.assertEquals( 8.0, polyhedronsSet.getSize(), 3.0e-6);<a name="line.299"></a>
+<span class="sourceLineNo">300</span>        Assert.assertEquals(24.0, polyhedronsSet.getBoundarySize(), 5.0e-6);<a name="line.300"></a>
+<span class="sourceLineNo">301</span>    }<a name="line.301"></a>
+<span class="sourceLineNo">302</span><a name="line.302"></a>
+<span class="sourceLineNo">303</span>    @Test<a name="line.303"></a>
+<span class="sourceLineNo">304</span>    public void testTooThinBox() {<a name="line.304"></a>
+<span class="sourceLineNo">305</span>        Assert.assertEquals(0.0,<a name="line.305"></a>
+<span class="sourceLineNo">306</span>                            new PolyhedronsSet(0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0e-10).getSize(),<a name="line.306"></a>
+<span class="sourceLineNo">307</span>                            1.0e-10);<a name="line.307"></a>
 <span class="sourceLineNo">308</span>    }<a name="line.308"></a>
 <span class="sourceLineNo">309</span><a name="line.309"></a>
-<span class="sourceLineNo">310</span>    private void checkPoints(Region.Location expected, PolyhedronsSet tree, Vector3D[] points) {<a name="line.310"></a>
-<span class="sourceLineNo">311</span>        for (int i = 0; i &lt; points.length; ++i) {<a name="line.311"></a>
-<span class="sourceLineNo">312</span>            Assert.assertEquals(expected, tree.checkPoint(points[i]));<a name="line.312"></a>
-<span class="sourceLineNo">313</span>        }<a name="line.313"></a>
-<span class="sourceLineNo">314</span>    }<a name="line.314"></a>
-<span class="sourceLineNo">315</span><a name="line.315"></a>
-<span class="sourceLineNo">316</span>}<a name="line.316"></a>
+<span class="sourceLineNo">310</span>    @Test<a name="line.310"></a>
+<span class="sourceLineNo">311</span>    public void testWrongUsage() {<a name="line.311"></a>
+<span class="sourceLineNo">312</span>        // the following is a wrong usage of the constructor.<a name="line.312"></a>
+<span class="sourceLineNo">313</span>        // as explained in the javadoc, the failure is NOT detected at construction<a name="line.313"></a>
+<span class="sourceLineNo">314</span>        // time but occurs later on<a name="line.314"></a>
+<span class="sourceLineNo">315</span>        PolyhedronsSet ps = new PolyhedronsSet(new BSPTree&lt;Euclidean3D&gt;(), 1.0e-10);<a name="line.315"></a>
+<span class="sourceLineNo">316</span>        Assert.assertNotNull(ps);<a name="line.316"></a>
+<span class="sourceLineNo">317</span>        try {<a name="line.317"></a>
+<span class="sourceLineNo">318</span>            ps.checkPoint(Vector3D.ZERO);<a name="line.318"></a>
+<span class="sourceLineNo">319</span>            Assert.fail("an exception should have been thrown");<a name="line.319"></a>
+<span class="sourceLineNo">320</span>        } catch (NullPointerException npe) {<a name="line.320"></a>
+<span class="sourceLineNo">321</span>            // this is expected<a name="line.321"></a>
+<span class="sourceLineNo">322</span>        }<a name="line.322"></a>
+<span class="sourceLineNo">323</span>    }<a name="line.323"></a>
+<span class="sourceLineNo">324</span><a name="line.324"></a>
+<span class="sourceLineNo">325</span>    @Test<a name="line.325"></a>
+<span class="sourceLineNo">326</span>    public void testDumpParse() throws IOException, ParseException {<a name="line.326"></a>
+<span class="sourceLineNo">327</span>        double tol=1e-8;<a name="line.327"></a>
+<span class="sourceLineNo">328</span>        <a name="line.328"></a>
+<span class="sourceLineNo">329</span>            Vector3D[] verts=new Vector3D[8];<a name="line.329"></a>
+<span class="sourceLineNo">330</span>            double xmin=-1,xmax=1;<a name="line.330"></a>
+<span class="sourceLineNo">331</span>            double ymin=-1,ymax=1;<a name="line.331"></a>
+<span class="sourceLineNo">332</span>            double zmin=-1,zmax=1;<a name="line.332"></a>
+<span class="sourceLineNo">333</span>            verts[0]=new Vector3D(xmin,ymin,zmin);<a name="line.333"></a>
+<span class="sourceLineNo">334</span>            verts[1]=new Vector3D(xmax,ymin,zmin);<a name="line.334"></a>
+<span class="sourceLineNo">335</span>            verts[2]=new Vector3D(xmax,ymax,zmin);<a name="line.335"></a>
+<span class="sourceLineNo">336</span>            verts[3]=new Vector3D(xmin,ymax,zmin);<a name="line.336"></a>
+<span class="sourceLineNo">337</span>            verts[4]=new Vector3D(xmin,ymin,zmax);<a name="line.337"></a>
+<span class="sourceLineNo">338</span>            verts[5]=new Vector3D(xmax,ymin,zmax);<a name="line.338"></a>
+<span class="sourceLineNo">339</span>            verts[6]=new Vector3D(xmax,ymax,zmax);<a name="line.339"></a>
+<span class="sourceLineNo">340</span>            verts[7]=new Vector3D(xmin,ymax,zmax);<a name="line.340"></a>
+<span class="sourceLineNo">341</span>            //<a name="line.341"></a>
+<span class="sourceLineNo">342</span>            int[][] faces=new int[12][];<a name="line.342"></a>
+<span class="sourceLineNo">343</span>            faces[0]=new int[]{3,1,0};  // bottom (-z)<a name="line.343"></a>
+<span class="sourceLineNo">344</span>            faces[1]=new int[]{1,3,2};  // bottom (-z)<a name="line.344"></a>
+<span class="sourceLineNo">345</span>            faces[2]=new int[]{5,7,4};  // top (+z)<a name="line.345"></a>
+<span class="sourceLineNo">346</span>            faces[3]=new int[]{7,5,6};  // top (+z)<a name="line.346"></a>
+<span class="sourceLineNo">347</span>            faces[4]=new int[]{2,5,1};  // right (+x)<a name="line.347"></a>
+<span class="sourceLineNo">348</span>            faces[5]=new int[]{5,2,6};  // right (+x)<a name="line.348"></a>
+<span class="sourceLineNo">349</span>            faces[6]=new int[]{4,3,0};  // left (-x)<a name="line.349"></a>
+<span class="sourceLineNo">350</span>            faces[7]=new int[]{3,4,7};  // left (-x)<a name="line.350"></a>
+<span class="sourceLineNo">351</span>            faces[8]=new int[]{4,1,5};  // front (-y)<a name="line.351"></a>
+<span class="sourceLineNo">352</span>            faces[9]=new int[]{1,4,0};  // front (-y)<a name="line.352"></a>
+<span class="sourceLineNo">353</span>            faces[10]=new int[]{3,6,2}; // back (+y)<a name="line.353"></a>
+<span class="sourceLineNo">354</span>            faces[11]=new int[]{6,3,7}; // back (+y)<a name="line.354"></a>
+<span class="sourceLineNo">355</span>            PolyhedronsSet polyset = new PolyhedronsSet(Arrays.asList(verts), Arrays.asList(faces), tol);<a name="line.355"></a>
+<span class="sourceLineNo">356</span>            Assert.assertEquals(8.0, polyset.getSize(), 1.0e-10);<a name="line.356"></a>
+<span class="sourceLineNo">357</span>            Assert.assertEquals(24.0, polyset.getBoundarySize(), 1.0e-10);<a name="line.357"></a>
+<span class="sourceLineNo">358</span>            String dump = RegionDumper.dump(polyset);<a name="line.358"></a>
+<span class="sourceLineNo">359</span>            PolyhedronsSet parsed = RegionParser.parsePolyhedronsSet(dump);<a name="line.359"></a>
+<span class="sourceLineNo">360</span>            Assert.assertEquals(8.0, parsed.getSize(), 1.0e-10);<a name="line.360"></a>
+<span class="sourceLineNo">361</span>            Assert.assertEquals(24.0, parsed.getBoundarySize(), 1.0e-10);<a name="line.361"></a>
+<span class="sourceLineNo">362</span>            Assert.assertTrue(new RegionFactory&lt;Euclidean3D&gt;().difference(polyset, parsed).isEmpty());<a name="line.362"></a>
+<span class="sourceLineNo">363</span>    }<a name="line.363"></a>
+<span class="sourceLineNo">364</span><a name="line.364"></a>
+<span class="sourceLineNo">365</span>    @Test<a name="line.365"></a>
+<span class="sourceLineNo">366</span>    public void testConnectedFacets() throws IOException, ParseException {<a name="line.366"></a>
+<span class="sourceLineNo">367</span>        InputStream stream = getClass().getResourceAsStream("pentomino-N.ply");<a name="line.367"></a>
+<span class="sourceLineNo">368</span>        PLYParser   parser = new PLYParser(stream);<a name="line.368"></a>
+<span class="sourceLineNo">369</span>        stream.close();<a name="line.369"></a>
+<span class="sourceLineNo">370</span>        PolyhedronsSet polyhedron = new PolyhedronsSet(parser.getVertices(), parser.getFaces(), 1.0e-10);<a name="line.370"></a>
+<span class="sourceLineNo">371</span>        Assert.assertEquals( 5.0, polyhedron.getSize(), 1.0e-10);<a name="line.371"></a>
+<span class="sourceLineNo">372</span>        Assert.assertEquals(22.0, polyhedron.getBoundarySize(), 1.0e-10);<a name="line.372"></a>
+<span class="sourceLineNo">373</span>    }<a name="line.373"></a>
+<span class="sourceLineNo">374</span><a name="line.374"></a>
+<span class="sourceLineNo">375</span>    @Test<a name="line.375"></a>
+<span class="sourceLineNo">376</span>    public void testTooClose() throws IOException, ParseException {<a name="line.376"></a>
+<span class="sourceLineNo">377</span>        checkError("pentomino-N-too-close.ply", LocalizedFormats.CLOSE_VERTICES);<a name="line.377"></a>
+<span class="sourceLineNo">378</span>    }<a name="line.378"></a>
+<span class="sourceLineNo">379</span><a name="line.379"></a>
+<span class="sourceLineNo">380</span>    @Test<a name="line.380"></a>
+<span class="sourceLineNo">381</span>    public void testHole() throws IOException, ParseException {<a name="line.381"></a>
+<span class="sourceLineNo">382</span>        checkError("pentomino-N-hole.ply", LocalizedFormats.EDGE_CONNECTED_TO_ONE_FACET);<a name="line.382"></a>
+<span class="sourceLineNo">383</span>    }<a name="line.383"></a>
+<span class="sourceLineNo">384</span><a name="line.384"></a>
+<span class="sourceLineNo">385</span>    @Test<a name="line.385"></a>
+<span class="sourceLineNo">386</span>    public void testNonPlanar() throws IOException, ParseException {<a name="line.386"></a>
+<span class="sourceLineNo">387</span>        checkError("pentomino-N-out-of-plane.ply", LocalizedFormats.OUT_OF_PLANE);<a name="line.387"></a>
+<span class="sourceLineNo">388</span>    }<a name="line.388"></a>
+<span class="sourceLineNo">389</span><a name="line.389"></a>
+<span class="sourceLineNo">390</span>    @Test<a name="line.390"></a>
+<span class="sourceLineNo">391</span>    public void testOrientation() throws IOException, ParseException {<a name="line.391"></a>
+<span class="sourceLineNo">392</span>        checkError("pentomino-N-bad-orientation.ply", LocalizedFormats.FACET_ORIENTATION_MISMATCH);<a name="line.392"></a>
+<span class="sourceLineNo">393</span>    }<a name="line.393"></a>
+<span class="sourceLineNo">394</span><a name="line.394"></a>
+<span class="sourceLineNo">395</span>    @Test<a name="line.395"></a>
+<span class="sourceLineNo">396</span>    public void testFacet2Vertices() throws IOException, ParseException {<a name="line.396"></a>
+<span class="sourceLineNo">397</span>        List&lt;Vector3D&gt; vertices = new ArrayList&lt;Vector3D&gt;();<a name="line.397"></a>
+<span class="sourceLineNo">398</span>        vertices.add(Vector3D.ZERO);<a name="line.398"></a>
+<span class="sourceLineNo">399</span>        vertices.add(Vector3D.PLUS_I);<a name="line.399"></a>
+<span class="sourceLineNo">400</span>        vertices.add(Vector3D.PLUS_J);<a name="line.400"></a>
+<span class="sourceLineNo">401</span>        vertices.add(Vector3D.PLUS_K);<a name="line.401"></a>
+<span class="sourceLineNo">402</span>        List&lt;int[]&gt; facets = new ArrayList&lt;int[]&gt;();<a name="line.402"></a>
+<span class="sourceLineNo">403</span>        facets.add(new int[] { 0, 1, 2 });<a name="line.403"></a>
+<span class="sourceLineNo">404</span>        facets.add(new int[] {2, 3});<a name="line.404"></a>
+<span class="sourceLineNo">405</span>        checkError(vertices, facets, LocalizedFormats.WRONG_NUMBER_OF_POINTS);<a name="line.405"></a>
+<span class="sourceLineNo">406</span>    }<a name="line.406"></a>
+<span class="sourceLineNo">407</span><a name="line.407"></a>
+<span class="sourceLineNo">408</span>    private void checkError(final String resourceName, final LocalizedFormats expected) {<a name="line.408"></a>
+<span class="sourceLineNo">409</span>        try {<a name="line.409"></a>
+<span class="sourceLineNo">410</span>            InputStream stream = getClass().getResourceAsStream(resourceName);<a name="line.410"></a>
+<span class="sourceLineNo">411</span>            PLYParser   parser = new PLYParser(stream);<a name="line.411"></a>
+<span class="sourceLineNo">412</span>            stream.close();<a name="line.412"></a>
+<span class="sourceLineNo">413</span>            checkError(parser.getVertices(), parser.getFaces(), expected);<a name="line.413"></a>
+<span class="sourceLineNo">414</span>        } catch (IOException ioe) {<a name="line.414"></a>
+<span class="sourceLineNo">415</span>            Assert.fail(ioe.getLocalizedMessage());<a name="line.415"></a>
+<span class="sourceLineNo">416</span>        } catch (ParseException pe) {<a name="line.416"></a>
+<span class="sourceLineNo">417</span>            Assert.fail(pe.getLocalizedMessage());<a name="line.417"></a>
+<span class="sourceLineNo">418</span>        }<a name="line.418"></a>
+<span class="sourceLineNo">419</span>    }<a name="line.419"></a>
+<span class="sourceLineNo">420</span><a name="line.420"></a>
+<span class="sourceLineNo">421</span>    private void checkError(final List&lt;Vector3D&gt; vertices, final List&lt;int[]&gt; facets,<a name="line.421"></a>
+<span class="sourceLineNo">422</span>                            final LocalizedFormats expected) {<a name="line.422"></a>
+<span class="sourceLineNo">423</span>        try {<a name="line.423"></a>
+<span class="sourceLineNo">424</span>            new PolyhedronsSet(vertices, facets, 1.0e-10);<a name="line.424"></a>
+<span class="sourceLineNo">425</span>            Assert.fail("an exception should have been thrown");<a name="line.425"></a>
+<span class="sourceLineNo">426</span>        } catch (MathIllegalArgumentException miae) {<a name="line.426"></a>
+<span class="sourceLineNo">427</span>            try {<a name="line.427"></a>
+<span class="sourceLineNo">428</span>                Field msgPatterns = ExceptionContext.class.getDeclaredField("msgPatterns");<a name="line.428"></a>
+<span class="sourceLineNo">429</span>                msgPatterns.setAccessible(true);<a name="line.429"></a>
+<span class="sourceLineNo">430</span>                @SuppressWarnings("unchecked")<a name="line.430"></a>
+<span class="sourceLineNo">431</span>                List&lt;Localizable&gt; list = (List&lt;Localizable&gt;) msgPatterns.get(miae.getContext());<a name="line.431"></a>
+<span class="sourceLineNo">432</span>                Assert.assertEquals(expected, list.get(0));<a name="line.432"></a>
+<span class="sourceLineNo">433</span>            } catch (NoSuchFieldException nsfe) {<a name="line.433"></a>
+<span class="sourceLineNo">434</span>                Assert.fail(nsfe.getLocalizedMessage());<a name="line.434"></a>
+<span class="sourceLineNo">435</span>            } catch (IllegalAccessException iae) {<a name="line.435"></a>
+<span class="sourceLineNo">436</span>                Assert.fail(iae.getLocalizedMessage());<a name="line.436"></a>
+<span class="sourceLineNo">437</span>            }<a name="line.437"></a>
+<span class="sourceLineNo">438</span>        }<a name="line.438"></a>
+<span class="sourceLineNo">439</span>    }<a name="line.439"></a>
+<span class="sourceLineNo">440</span><a name="line.440"></a>
+<span class="sourceLineNo">441</span>    @Test<a name="line.441"></a>
+<span class="sourceLineNo">442</span>    public void testIssue1211() throws IOException, ParseException {<a name="line.442"></a>
+<span class="sourceLineNo">443</span><a name="line.443"></a>
+<span class="sourceLineNo">444</span>        PolyhedronsSet polyset = RegionParser.parsePolyhedronsSet(loadTestData("issue-1211.bsp"));<a name="line.444"></a>
+<span class="sourceLineNo">445</span>        RandomGenerator random = new Well1024a(0xb97c9d1ade21e40al);<a name="line.445"></a>
+<span class="sourceLineNo">446</span>        int nrays = 1000;<a name="line.446"></a>
+<span class="sourceLineNo">447</span>        for (int i = 0; i &lt; nrays; i++) {<a name="line.447"></a>
+<span class="sourceLineNo">448</span>            Vector3D origin    = Vector3D.ZERO;<a name="line.448"></a>
+<span class="sourceLineNo">449</span>            Vector3D direction = new Vector3D(2 * random.nextDouble() - 1,<a name="line.449"></a>
+<span class="sourceLineNo">450</span>                                              2 * random.nextDouble() - 1,<a name="line.450"></a>
+<span class="sourceLineNo">451</span>                                              2 * random.nextDouble() - 1).normalize();<a name="line.451"></a>
+<span class="sourceLineNo">452</span>            Line line = new Line(origin, origin.add(direction), polyset.getTolerance());<a name="line.452"></a>
+<span class="sourceLineNo">453</span>            SubHyperplane&lt;Euclidean3D&gt; plane = polyset.firstIntersection(origin, line);<a name="line.453"></a>
+<span class="sourceLineNo">454</span>            if (plane != null) {<a name="line.454"></a>
+<span class="sourceLineNo">455</span>                Vector3D intersectionPoint = ((Plane)plane.getHyperplane()).intersection(line);<a name="line.455"></a>
+<span class="sourceLineNo">456</span>                double dotProduct = direction.dotProduct(intersectionPoint.subtract(origin));<a name="line.456"></a>
+<span class="sourceLineNo">457</span>                Assert.assertTrue(dotProduct &gt; 0);<a name="line.457"></a>
+<span class="sourceLineNo">458</span>            }<a name="line.458"></a>
+<span class="sourceLineNo">459</span>        }<a name="line.459"></a>
+<span class="sourceLineNo">460</span>    }<a name="line.460"></a>
+<span class="sourceLineNo">461</span><a name="line.461"></a>
+<span class="sourceLineNo">462</span>    private String loadTestData(final String resourceName)<a name="line.462"></a>
+<span class="sourceLineNo">463</span>            throws IOException {<a name="line.463"></a>
+<span class="sourceLineNo">464</span>            InputStream stream = getClass().getResourceAsStream(resourceName);<a name="line.464"></a>
+<span class="sourceLineNo">465</span>            Reader reader = new InputStreamReader(stream, "UTF-8");<a name="line.465"></a>
+<span class="sourceLineNo">466</span>            StringBuilder builder = new StringBuilder();<a name="line.466"></a>
+<span class="sourceLineNo">467</span>            for (int c = reader.read(); c &gt;= 0; c = reader.read()) {<a name="line.467"></a>
+<span class="sourceLineNo">468</span>                builder.append((char) c);<a name="line.468"></a>
+<span class="sourceLineNo">469</span>            }<a name="line.469"></a>
+<span class="sourceLineNo">470</span>            return builder.toString();<a name="line.470"></a>
+<span class="sourceLineNo">471</span>        }<a name="line.471"></a>
+<span class="sourceLineNo">472</span><a name="line.472"></a>
+<span class="sourceLineNo">473</span>    private void checkPoints(Region.Location expected, PolyhedronsSet tree, Vector3D[] points) {<a name="line.473"></a>
+<span class="sourceLineNo">474</span>        for (int i = 0; i &lt; points.length; ++i) {<a name="line.474"></a>
+<span class="sourceLineNo">475</span>            Assert.assertEquals(expected, tree.checkPoint(points[i]));<a name="line.475"></a>
+<span class="sourceLineNo">476</span>        }<a name="line.476"></a>
+<span class="sourceLineNo">477</span>    }<a name="line.477"></a>
+<span class="sourceLineNo">478</span><a name="line.478"></a>
+<span class="sourceLineNo">479</span>}<a name="line.479"></a>
 
 
 



Mime
View raw message