Skip to content
Permalink
Browse files
GEOMETRY-92: adding specialized segment, ray, and reverse ray classes…
… for 2D and 3D; GEOMETRY-93: major refactor from 'subhyperplane' naming convention to 'hyperplane-subset' naming convention
  • Loading branch information
darkma773r committed May 6, 2020
1 parent dee683c commit eee258978cae8fe4987c2155ddfbd08c73d3c9db
Show file tree
Hide file tree
Showing 168 changed files with 11,665 additions and 7,475 deletions.
@@ -36,36 +36,36 @@
public interface Embedding<P extends Point<P>, S extends Point<S>> {

/** Transform a space point into a subspace point.
* @param point n-dimension point of the space
* @param pt n-dimension point of the space
* @return lower-dimension point of the subspace corresponding to
* the specified space point
* @see #toSpace
*/
S toSubspace(P point);
S toSubspace(P pt);

/** Transform a collection of space points into subspace points.
* @param points collection of n-dimension points to transform
* @param pts collection of n-dimension points to transform
* @return collection of transformed lower-dimension points.
* @see #toSubspace(Point)
*/
default List<S> toSubspace(final Collection<P> points) {
return points.stream().map(this::toSubspace).collect(Collectors.toList());
default List<S> toSubspace(final Collection<P> pts) {
return pts.stream().map(this::toSubspace).collect(Collectors.toList());
}

/** Transform a subspace point into a space point.
* @param point lower-dimension point of the subspace
* @param pt lower-dimension point of the subspace
* @return n-dimension point of the space corresponding to the
* specified subspace point
* @see #toSubspace(Point)
*/
P toSpace(S point);
P toSpace(S pt);

/** Transform a collection of subspace points into space points.
* @param points collection of lower-dimension points to transform
* @param pts collection of lower-dimension points to transform
* @return collection of transformed n-dimension points.
* @see #toSpace(Point)
*/
default List<P> toSpace(final Collection<S> points) {
return points.stream().map(this::toSpace).collect(Collectors.toList());
default List<P> toSpace(final Collection<S> pts) {
return pts.stream().map(this::toSpace).collect(Collectors.toList());
}
}
@@ -20,7 +20,7 @@
* into sets of points lying on the inside, outside, and boundary.
* @param <P> Point implementation type
*/
public interface Region<P extends Point<P>> {
public interface Region<P extends Point<P>> extends Sized {

/** Return true if the region spans the entire space. In other words,
* a region is full if no points in the space are classified as
@@ -35,13 +35,6 @@
*/
boolean isEmpty();

/** Get the size of the region. The meaning of this will vary depending on
* the space and dimension of the region. For example, in Euclidean space,
* this will be a length in 1D, an area in 2D, and a volume in 3D.
* @return the size of the region
*/
double getSize();

/** Get the size of the boundary of the region. The size is a value in
* the {@code d-1} dimension space. For example, in Euclidean space,
* this will be a length in 2D and an area in 3D.
@@ -0,0 +1,41 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.geometry.core;

/** Interface representing a geometric element that embeds a region in a subspace.
* @param <P> Point type defining the embedding space.
* @param <S> Point type defining the embedded subspace.
* @see Embedding
* @see Region
*/
public interface RegionEmbedding<P extends Point<P>, S extends Point<S>>
extends Embedding<P, S>, Sized {

/** Get the size of the instance, which by default is the size of the embedded
* subspace region.
* @return the size of instance
*/
@Override
default double getSize() {
return getSubspaceRegion().getSize();
}

/** Get the embedded subspace region.
* @return the embedded subspace region
*/
Region<S> getSubspaceRegion();
}
@@ -0,0 +1,43 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.geometry.core;

/** Interface representing a geometric element with a size. The exact meaning
* of the size will vary between spaces and dimensions. For example, the size
* of a line is its length, while the size of a polygon is its area.
*/
public interface Sized {

/** Get the size of the instance.
* @return the size of the instance
*/
double getSize();

/** Return true if the size of the instance is finite.
* @return true if the size of the instance is finite
*/
default boolean isFinite() {
return Double.isFinite(getSize());
}

/** Return true if the size of the instance is infinite.
* @return true if the size of the instance is infinite
*/
default boolean isInfinite() {
return Double.isInfinite(getSize());
}
}

0 comments on commit eee2589

Please sign in to comment.