Search in sources :

Example 6 with Sphere2D

use of org.hipparchus.geometry.spherical.twod.Sphere2D in project Orekit by CS-SI.

the class SphericalPolygonsSetTransferObject method rebuildZone.

/**
 * Rebuild the zone from saved data.
 * @return rebuilt zone
 */
public SphericalPolygonsSet rebuildZone() {
    // rebuild the tree from the flattened arrays
    BSPTree<Sphere2D> node = new BSPTree<Sphere2D>();
    final int nbNodes = cuts.length / 3 + leafs.length;
    cutIndex = 0;
    flagIndex = 0;
    for (nodeIndex = 0; nodeIndex < nbNodes; ++nodeIndex) {
        if (leafs[flagIndex] == nodeIndex) {
            // this is a leaf node
            node.setAttribute(Boolean.valueOf(flags[flagIndex++]));
            while (node.getParent() != null) {
                final BSPTree<Sphere2D> parent = node.getParent();
                if (node == parent.getMinus()) {
                    node = parent.getPlus();
                    break;
                } else {
                    node = parent;
                }
            }
        } else {
            // this is an internal node
            final double x = cuts[cutIndex++];
            final double y = cuts[cutIndex++];
            final double z = cuts[cutIndex++];
            node.insertCut(new Circle(new Vector3D(x, y, z), tolerance));
            node = node.getMinus();
        }
    }
    return new SphericalPolygonsSet(node, tolerance);
}
Also used : BSPTree(org.hipparchus.geometry.partitioning.BSPTree) Circle(org.hipparchus.geometry.spherical.twod.Circle) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Sphere2D(org.hipparchus.geometry.spherical.twod.Sphere2D) SphericalPolygonsSet(org.hipparchus.geometry.spherical.twod.SphericalPolygonsSet)

Aggregations

Sphere2D (org.hipparchus.geometry.spherical.twod.Sphere2D)6 SphericalPolygonsSet (org.hipparchus.geometry.spherical.twod.SphericalPolygonsSet)5 ArrayList (java.util.ArrayList)3 S2Point (org.hipparchus.geometry.spherical.twod.S2Point)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 ObjectInputStream (java.io.ObjectInputStream)2 ObjectOutputStream (java.io.ObjectOutputStream)2 IdentityHashMap (java.util.IdentityHashMap)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 Map (java.util.Map)2 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)2 RegionFactory (org.hipparchus.geometry.partitioning.RegionFactory)2 Test (org.junit.Test)2 GeodeticPoint (org.orekit.bodies.GeodeticPoint)2 BSPTree (org.hipparchus.geometry.partitioning.BSPTree)1 Circle (org.hipparchus.geometry.spherical.twod.Circle)1 BodyShape (org.orekit.bodies.BodyShape)1 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)1