Search in sources :

Example 1 with Circle

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

the class EllipsoidTessellator method meetInside.

/**
 * Check if an arc meets the inside of a zone.
 * @param s1 first point
 * @param s2 second point
 * @param zone zone to check arc against
 * @return true if the arc meets the inside of the zone
 */
private boolean meetInside(final S2Point s1, final S2Point s2, final SphericalPolygonsSet zone) {
    final Circle circle = new Circle(s1, s2, zone.getTolerance());
    final double alpha1 = circle.toSubSpace(s1).getAlpha();
    final double alpha2 = MathUtils.normalizeAngle(circle.toSubSpace(s2).getAlpha(), alpha1 + FastMath.PI);
    final SubCircle sub = new SubCircle(circle, new ArcsSet(alpha1, alpha2, zone.getTolerance()));
    return recurseMeetInside(zone.getTree(false), sub);
}
Also used : Circle(org.hipparchus.geometry.spherical.twod.Circle) SubCircle(org.hipparchus.geometry.spherical.twod.SubCircle) ArcsSet(org.hipparchus.geometry.spherical.oned.ArcsSet) SubCircle(org.hipparchus.geometry.spherical.twod.SubCircle)

Example 2 with Circle

use of org.hipparchus.geometry.spherical.twod.Circle 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

Circle (org.hipparchus.geometry.spherical.twod.Circle)2 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)1 BSPTree (org.hipparchus.geometry.partitioning.BSPTree)1 ArcsSet (org.hipparchus.geometry.spherical.oned.ArcsSet)1 Sphere2D (org.hipparchus.geometry.spherical.twod.Sphere2D)1 SphericalPolygonsSet (org.hipparchus.geometry.spherical.twod.SphericalPolygonsSet)1 SubCircle (org.hipparchus.geometry.spherical.twod.SubCircle)1