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);
}
Aggregations