Skip to content

Commit 0e22bd7

Browse files
committed
Cleanup.
1 parent 2bd5f97 commit 0e22bd7

22 files changed

+334
-351
lines changed

hipparchus-geometry/src/main/java/org/hipparchus/geometry/euclidean/threed/OutlineExtractor.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.hipparchus.geometry.partitioning.RegionFactory;
3434
import org.hipparchus.geometry.partitioning.SubHyperplane;
3535
import org.hipparchus.util.FastMath;
36+
import org.hipparchus.util.MathUtils;
3637

3738
/** Extractor for {@link PolygonsSet polyhedrons sets} outlines.
3839
* <p>This class extracts the 2D outlines from {{@link PolygonsSet
@@ -223,7 +224,7 @@ private void addContribution(final SubHyperplane<Euclidean3D, Vector3D> facet) {
223224
if (closed || (previous != 1)) {
224225
// the previous point is a real vertex
225226
// it defines one bounding point of the edge
226-
final double angle = line.getAngle() + 0.5 * FastMath.PI;
227+
final double angle = line.getAngle() + MathUtils.SEMI_PI;
227228
final org.hipparchus.geometry.euclidean.twod.Line l =
228229
new org.hipparchus.geometry.euclidean.twod.Line(pPoint, angle, tolerance);
229230
edge = edge.split(l).getPlus();
@@ -232,7 +233,7 @@ private void addContribution(final SubHyperplane<Euclidean3D, Vector3D> facet) {
232233
if (closed || (current != (loop.length - 1))) {
233234
// the current point is a real vertex
234235
// it defines one bounding point of the edge
235-
final double angle = line.getAngle() + 0.5 * FastMath.PI;
236+
final double angle = line.getAngle() + MathUtils.SEMI_PI;
236237
final org.hipparchus.geometry.euclidean.twod.Line l =
237238
new org.hipparchus.geometry.euclidean.twod.Line(cPoint, angle, tolerance);
238239
edge = edge.split(l).getMinus();

hipparchus-geometry/src/main/java/org/hipparchus/geometry/partitioning/AbstractSubHyperplane.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ public AbstractSubHyperplane<S, P, T, Q> applyTransform(final Transform<S, P, T,
153153
* @return a new tree
154154
*/
155155
private BSPTree<T, Q> recurseTransform(final BSPTree<T, Q> node,
156-
final Hyperplane<S, P> transformed,
157-
final Transform<S, P, T, Q> transform,
158-
final Map<BSPTree<T, Q>, BSPTree<T, Q>> map) {
156+
final Hyperplane<S, P> transformed,
157+
final Transform<S, P, T, Q> transform,
158+
final Map<BSPTree<T, Q>, BSPTree<T, Q>> map) {
159159

160160
final BSPTree<T, Q> transformedNode;
161161
if (node.getCut() == null) {

hipparchus-geometry/src/main/java/org/hipparchus/geometry/partitioning/Hyperplane.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
public interface Hyperplane<S extends Space, P extends Point<S>> {
5050

5151
/** Copy the instance.
52-
* <p>The instance created is completely independant of the original
52+
* <p>The instance created is completely independent of the original
5353
* one. A deep copy is used, none of the underlying objects are
5454
* shared (except for immutable objects).</p>
5555
* @return a new hyperplane, copy of the instance

hipparchus-geometry/src/main/java/org/hipparchus/geometry/partitioning/SubHyperplane.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
public interface SubHyperplane<S extends Space, P extends Point<S>> {
4949

5050
/** Copy the instance.
51-
* <p>The instance created is completely independent of the original
51+
* <p>The instance created is completely independent from the original
5252
* one. A deep copy is used, none of the underlying objects are
5353
* shared (except for the nodes attributes and immutable
5454
* objects).</p>

hipparchus-geometry/src/main/java/org/hipparchus/geometry/spherical/twod/Circle.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.hipparchus.geometry.spherical.oned.S1Point;
3636
import org.hipparchus.geometry.spherical.oned.Sphere1D;
3737
import org.hipparchus.util.FastMath;
38+
import org.hipparchus.util.MathUtils;
3839
import org.hipparchus.util.SinCos;
3940

4041
/** This class represents an oriented great circle on the 2-sphere.
@@ -77,7 +78,7 @@ public Circle(final Vector3D pole, final double tolerance)
7778
}
7879

7980
/** Build a great circle from two non-aligned points.
80-
* <p>The circle is oriented from first to second point using the path smaller than \( \pi \).</p>
81+
* <p>The circle is oriented from first to second point using the path smaller than π.</p>
8182
* @param first first point contained in the great circle
8283
* @param second second point contained in the great circle
8384
* @param tolerance tolerance below which close sub-arcs are merged together
@@ -221,7 +222,7 @@ public Vector3D getXAxis() {
221222
/** Get the Y axis of the circle.
222223
* <p>
223224
* This method returns the same value as {@link #getPointAt(double)
224-
* getPointAt(0.5 * FastMath.PI)} but it does not do any computation and always
225+
* getPointAt(MathUtils.SEMI_PI)} but it does not do any computation and always
225226
* return the same instance.
226227
* </p>
227228
* @return an arbitrary y axis point on the circle
@@ -252,8 +253,7 @@ public Vector3D getPole() {
252253
*/
253254
public Arc getInsideArc(final Circle other) {
254255
final double alpha = getPhase(other.pole);
255-
final double halfPi = 0.5 * FastMath.PI;
256-
return new Arc(alpha - halfPi, alpha + halfPi, tolerance);
256+
return new Arc(alpha - MathUtils.SEMI_PI, alpha + MathUtils.SEMI_PI, tolerance);
257257
}
258258

259259
/** {@inheritDoc} */
@@ -295,7 +295,7 @@ public double getOffset(final S2Point point) {
295295
* @see #getOffset(S2Point)
296296
*/
297297
public double getOffset(final Vector3D direction) {
298-
return Vector3D.angle(pole, direction) - 0.5 * FastMath.PI;
298+
return Vector3D.angle(pole, direction) - MathUtils.SEMI_PI;
299299
}
300300

301301
/** {@inheritDoc} */

hipparchus-geometry/src/main/java/org/hipparchus/geometry/spherical/twod/Edge.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void setNextEdge(final Edge next) {
129129
* vertices are introduced to connect these sub-edges together.
130130
* </p>
131131
* @param splitCircle circle splitting the edge in several parts
132-
* @param outsideList list where to put parts that are outside of the split circle
132+
* @param outsideList list where to put parts that are outside the split circle
133133
* @param insideList list where to put parts that are inside the split circle
134134
*/
135135
void split(final Circle splitCircle, final List<Edge> outsideList, final List<Edge> insideList) {
@@ -164,12 +164,12 @@ void split(final Circle splitCircle, final List<Edge> outsideList, final List<Ed
164164
}
165165

166166
if (arcRelativeStart >= length - tolerance) {
167-
// the edge ends while still outside of the circle
167+
// the edge ends while still outside the circle
168168
if (unwrappedEnd >= 0) {
169169
addSubEdge(previousVertex, end,
170170
length - alreadyManagedLength, outsideList);
171171
} else {
172-
// the edge is entirely outside of the circle
172+
// the edge is entirely outside the circle
173173
// we don't split anything
174174
outsideList.add(this);
175175
}
@@ -181,11 +181,11 @@ void split(final Circle splitCircle, final List<Edge> outsideList, final List<Ed
181181
alreadyManagedLength = arcRelativeStart;
182182

183183
if (arcRelativeEnd >= length - tolerance) {
184-
// the edge ends while still inside of the circle
184+
// the edge ends while still inside the circle
185185
addSubEdge(previousVertex, end,
186186
length - alreadyManagedLength, insideList);
187187
} else {
188-
// the edge is long enough to exit outside of the circle
188+
// the edge is long enough to exit outside the circle
189189
previousVertex = addSubEdge(previousVertex,
190190
new Vertex(new S2Point(circle.getPointAt(edgeStart + arcRelativeEnd))),
191191
arcRelativeEnd - alreadyManagedLength, insideList);

hipparchus-geometry/src/main/java/org/hipparchus/geometry/spherical/twod/PropertiesComputer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ class PropertiesComputer implements BSPTreeVisitor<Sphere2D, S2Point> {
5151
* @param tolerance below which points are consider to be identical
5252
*/
5353
PropertiesComputer(final double tolerance) {
54-
this.tolerance = tolerance;
55-
this.summedArea = 0;
56-
this.summedBarycenter = Vector3D.ZERO;
54+
this.tolerance = tolerance;
55+
this.summedArea = 0;
56+
this.summedBarycenter = Vector3D.ZERO;
5757
this.convexCellsInsidePoints = new ArrayList<>();
5858
}
5959

hipparchus-geometry/src/main/java/org/hipparchus/geometry/spherical/twod/S2Point.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@
4343
public class S2Point implements Point<Sphere2D> {
4444

4545
/** +I (coordinates: \( \theta = 0, \varphi = \pi/2 \)). */
46-
public static final S2Point PLUS_I = new S2Point(0, 0.5 * FastMath.PI, Vector3D.PLUS_I);
46+
public static final S2Point PLUS_I = new S2Point(0, MathUtils.SEMI_PI, Vector3D.PLUS_I);
4747

4848
/** +J (coordinates: \( \theta = \pi/2, \varphi = \pi/2 \))). */
49-
public static final S2Point PLUS_J = new S2Point(0.5 * FastMath.PI, 0.5 * FastMath.PI, Vector3D.PLUS_J);
49+
public static final S2Point PLUS_J = new S2Point(MathUtils.SEMI_PI, MathUtils.SEMI_PI, Vector3D.PLUS_J);
5050

5151
/** +K (coordinates: \( \theta = any angle, \varphi = 0 \)). */
5252
public static final S2Point PLUS_K = new S2Point(0, 0, Vector3D.PLUS_K);
5353

5454
/** -I (coordinates: \( \theta = \pi, \varphi = \pi/2 \)). */
55-
public static final S2Point MINUS_I = new S2Point(FastMath.PI, 0.5 * FastMath.PI, Vector3D.MINUS_I);
55+
public static final S2Point MINUS_I = new S2Point(FastMath.PI, MathUtils.SEMI_PI, Vector3D.MINUS_I);
5656

5757
/** -J (coordinates: \( \theta = 3\pi/2, \varphi = \pi/2 \)). */
58-
public static final S2Point MINUS_J = new S2Point(1.5 * FastMath.PI, 0.5 * FastMath.PI, Vector3D.MINUS_J);
58+
public static final S2Point MINUS_J = new S2Point(1.5 * FastMath.PI, MathUtils.SEMI_PI, Vector3D.MINUS_J);
5959

6060
/** -K (coordinates: \( \theta = any angle, \varphi = \pi \)). */
6161
public static final S2Point MINUS_K = new S2Point(0, FastMath.PI, Vector3D.MINUS_K);

hipparchus-geometry/src/main/java/org/hipparchus/geometry/spherical/twod/SphericalPolygonsSet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,12 +774,12 @@ public EnclosingBall<Sphere2D, S2Point> getEnclosingCap() {
774774
if (isEmpty(root.getMinus()) && isFull(root.getPlus())) {
775775
// the polygon covers an hemisphere, and its boundary is one 2π long edge
776776
final Circle circle = (Circle) root.getCut().getHyperplane();
777-
return new EnclosingBall<>(new S2Point(circle.getPole()).negate(), 0.5 * FastMath.PI);
777+
return new EnclosingBall<>(new S2Point(circle.getPole()).negate(), MathUtils.SEMI_PI);
778778
}
779779
if (isFull(root.getMinus()) && isEmpty(root.getPlus())) {
780780
// the polygon covers an hemisphere, and its boundary is one 2π long edge
781781
final Circle circle = (Circle) root.getCut().getHyperplane();
782-
return new EnclosingBall<>(new S2Point(circle.getPole()), 0.5 * FastMath.PI);
782+
return new EnclosingBall<>(new S2Point(circle.getPole()), MathUtils.SEMI_PI);
783783
}
784784

785785
// gather some inside points, to be used by the encloser

0 commit comments

Comments
 (0)