本文整理汇总了Java中org.apache.commons.math3.geometry.euclidean.oned.Interval类的典型用法代码示例。如果您正苦于以下问题:Java Interval类的具体用法?Java Interval怎么用?Java Interval使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Interval类属于org.apache.commons.math3.geometry.euclidean.oned包,在下文中一共展示了Interval类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getSegments
import org.apache.commons.math3.geometry.euclidean.oned.Interval; //导入依赖的package包/类
/** Get the endpoints of the sub-line.
* <p>
* A subline may be any arbitrary number of disjoints segments, so the endpoints
* are provided as a list of endpoint pairs. Each element of the list represents
* one segment, and each segment contains a start point at index 0 and an end point
* at index 1. If the sub-line is unbounded in the negative infinity direction,
* the start point of the first segment will have infinite coordinates. If the
* sub-line is unbounded in the positive infinity direction, the end point of the
* last segment will have infinite coordinates. So a sub-line covering the whole
* line will contain just one row and both elements of this row will have infinite
* coordinates. If the sub-line is empty, the returned list will contain 0 segments.
* </p>
* @return list of segments endpoints
*/
public List<Segment> getSegments() {
final Line line = (Line) getHyperplane();
final List<Interval> list = ((IntervalsSet) getRemainingRegion()).asList();
final List<Segment> segments = new ArrayList<Segment>(list.size());
for (final Interval interval : list) {
final Vector2D start = line.toSpace((Point<Euclidean1D>) new Vector1D(interval.getInf()));
final Vector2D end = line.toSpace((Point<Euclidean1D>) new Vector1D(interval.getSup()));
segments.add(new Segment(start, end, line));
}
return segments;
}
开发者ID:biocompibens,项目名称:SME,代码行数:30,代码来源:SubLine.java
示例2: getSegments
import org.apache.commons.math3.geometry.euclidean.oned.Interval; //导入依赖的package包/类
/** Get the endpoints of the sub-line.
* <p>
* A subline may be any arbitrary number of disjoints segments, so the endpoints
* are provided as a list of endpoint pairs. Each element of the list represents
* one segment, and each segment contains a start point at index 0 and an end point
* at index 1. If the sub-line is unbounded in the negative infinity direction,
* the start point of the first segment will have infinite coordinates. If the
* sub-line is unbounded in the positive infinity direction, the end point of the
* last segment will have infinite coordinates. So a sub-line covering the whole
* line will contain just one row and both elements of this row will have infinite
* coordinates. If the sub-line is empty, the returned list will contain 0 segments.
* </p>
* @return list of segments endpoints
*/
public List<Segment> getSegments() {
final Line line = (Line) getHyperplane();
final List<Interval> list = ((IntervalsSet) getRemainingRegion()).asList();
final List<Segment> segments = new ArrayList<Segment>();
for (final Interval interval : list) {
final Vector2D start = line.toSpace(new Vector1D(interval.getLower()));
final Vector2D end = line.toSpace(new Vector1D(interval.getUpper()));
segments.add(new Segment(start, end, line));
}
return segments;
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:30,代码来源:SubLine.java
示例3: addContribution
import org.apache.commons.math3.geometry.euclidean.oned.Interval; //导入依赖的package包/类
/** Add he contribution of a boundary facet.
* @param sub boundary facet
* @param reversed if true, the facet has the inside on its plus side
*/
private void addContribution(final SubHyperplane<Euclidean2D> sub, final boolean reversed) {
@SuppressWarnings("unchecked")
final AbstractSubHyperplane<Euclidean2D, Euclidean1D> absSub =
(AbstractSubHyperplane<Euclidean2D, Euclidean1D>) sub;
final Line line = (Line) sub.getHyperplane();
final List<Interval> intervals = ((IntervalsSet) absSub.getRemainingRegion()).asList();
for (final Interval i : intervals) {
final Vector2D start = Double.isInfinite(i.getLower()) ?
null : (Vector2D) line.toSpace(new Vector1D(i.getLower()));
final Vector2D end = Double.isInfinite(i.getUpper()) ?
null : (Vector2D) line.toSpace(new Vector1D(i.getUpper()));
if (reversed) {
sorted.insert(new ComparableSegment(end, start, line.getReverse()));
} else {
sorted.insert(new ComparableSegment(start, end, line));
}
}
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:23,代码来源:PolygonsSet.java
示例4: getSegments
import org.apache.commons.math3.geometry.euclidean.oned.Interval; //导入依赖的package包/类
/** Get the endpoints of the sub-line.
* <p>
* A subline may be any arbitrary number of disjoints segments, so the endpoints
* are provided as a list of endpoint pairs. Each element of the list represents
* one segment, and each segment contains a start point at index 0 and an end point
* at index 1. If the sub-line is unbounded in the negative infinity direction,
* the start point of the first segment will have infinite coordinates. If the
* sub-line is unbounded in the positive infinity direction, the end point of the
* last segment will have infinite coordinates. So a sub-line covering the whole
* line will contain just one row and both elements of this row will have infinite
* coordinates. If the sub-line is empty, the returned list will contain 0 segments.
* </p>
* @return list of segments endpoints
*/
public List<Segment> getSegments() {
final Line line = (Line) getHyperplane();
final List<Interval> list = ((IntervalsSet) getRemainingRegion()).asList();
final List<Segment> segments = new ArrayList<Segment>(list.size());
for (final Interval interval : list) {
final Vector2D start = line.toSpace(new Vector1D(interval.getInf()));
final Vector2D end = line.toSpace(new Vector1D(interval.getSup()));
segments.add(new Segment(start, end, line));
}
return segments;
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:30,代码来源:SubLine.java
示例5: addContribution
import org.apache.commons.math3.geometry.euclidean.oned.Interval; //导入依赖的package包/类
/** Add he contribution of a boundary facet.
* @param sub boundary facet
* @param reversed if true, the facet has the inside on its plus side
*/
private void addContribution(final SubHyperplane<Euclidean2D> sub, final boolean reversed) {
@SuppressWarnings("unchecked")
final AbstractSubHyperplane<Euclidean2D, Euclidean1D> absSub =
(AbstractSubHyperplane<Euclidean2D, Euclidean1D>) sub;
final Line line = (Line) sub.getHyperplane();
final List<Interval> intervals = ((IntervalsSet) absSub.getRemainingRegion()).asList();
for (final Interval i : intervals) {
final Vector2D start = Double.isInfinite(i.getInf()) ?
null : (Vector2D) line.toSpace(new Vector1D(i.getInf()));
final Vector2D end = Double.isInfinite(i.getSup()) ?
null : (Vector2D) line.toSpace(new Vector1D(i.getSup()));
if (reversed) {
sorted.insert(new ComparableSegment(end, start, line.getReverse()));
} else {
sorted.insert(new ComparableSegment(start, end, line));
}
}
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:23,代码来源:PolygonsSet.java
示例6: getSegments
import org.apache.commons.math3.geometry.euclidean.oned.Interval; //导入依赖的package包/类
/** Get the endpoints of the sub-line.
* <p>
* A subline may be any arbitrary number of disjoints segments, so the endpoints
* are provided as a list of endpoint pairs. Each element of the list represents
* one segment, and each segment contains a start point at index 0 and an end point
* at index 1. If the sub-line is unbounded in the negative infinity direction,
* the start point of the first segment will have infinite coordinates. If the
* sub-line is unbounded in the positive infinity direction, the end point of the
* last segment will have infinite coordinates. So a sub-line covering the whole
* line will contain just one row and both elements of this row will have infinite
* coordinates. If the sub-line is empty, the returned list will contain 0 segments.
* </p>
* @return list of segments endpoints
*/
public List<Segment> getSegments() {
final Line line = (Line) getHyperplane();
final List<Interval> list = ((IntervalsSet) getRemainingRegion()).asList();
final List<Segment> segments = new ArrayList<Segment>();
for (final Interval interval : list) {
final Vector2D start = line.toSpace(new Vector1D(interval.getInf()));
final Vector2D end = line.toSpace(new Vector1D(interval.getSup()));
segments.add(new Segment(start, end, line));
}
return segments;
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:30,代码来源:SubLine.java
示例7: SMDPEstimator
import org.apache.commons.math3.geometry.euclidean.oned.Interval; //导入依赖的package包/类
/**
* Constructs an SMDP estimator.
*
* @param dummyState
* the dummy state should be a symbol that does not represent any
* real state in the SMDP. When a state-action pair is "unknown"
* it is assumed that they transition with probability 1 to the
* dummy state.
* @param actionSet
* an action set
* @param numSamplesBeforeKnown
* the number of samples needed at a state-action pair before it
* is considered "known"
* @param optimistic
* true if this estimator will be optimistic about "unknown"
* state-action pairs; false if it will be pessimistic about them
* @param immediateRInterval
* an interval containing the smallest and largest possible
* reinforcements that can be received in a single timestep
* @param opType
* the optimization type (MINIMIZE or MAXIMIZE)
*/
public SMDPEstimator(S dummyState, ActionSet<S, A> actionSet,
int numSamplesBeforeKnown, boolean optimistic,
Interval immediateRInterval, Optimization opType) {
super(actionSet, opType);
if (dummyState == null) {
throw new NullPointerException("Dummy state cannot be null.");
}
_dummyState = dummyState;
_rInterval = immediateRInterval;
if (numSamplesBeforeKnown < 1) {
throw new IllegalArgumentException(
"The number of samples needed before a "
+ "state-action pair can be considered"
+ " known must be positive. "
+ "Expected positive integer. Found "
+ numSamplesBeforeKnown + ".");
}
_m = numSamplesBeforeKnown;
_optimistic = optimistic;
reset();
}
开发者ID:kingtim1,项目名称:jmdp,代码行数:46,代码来源:SMDPEstimator.java
示例8: getSegments
import org.apache.commons.math3.geometry.euclidean.oned.Interval; //导入依赖的package包/类
/** Get the endpoints of the sub-line.
* <p>
* A subline may be any arbitrary number of disjoints segments, so the endpoints
* are provided as a list of endpoint pairs. Each element of the list represents
* one segment, and each segment contains a start point at index 0 and an end point
* at index 1. If the sub-line is unbounded in the negative infinity direction,
* the start point of the first segment will have infinite coordinates. If the
* sub-line is unbounded in the positive infinity direction, the end point of the
* last segment will have infinite coordinates. So a sub-line covering the whole
* line will contain just one row and both elements of this row will have infinite
* coordinates. If the sub-line is empty, the returned list will contain 0 segments.
* </p>
* @return list of segments endpoints
*/
public List<Segment> getSegments() {
final List<Interval> list = remainingRegion.asList();
final List<Segment> segments = new ArrayList<Segment>(list.size());
for (final Interval interval : list) {
final Vector3D start = line.toSpace((Point<Euclidean1D>) new Vector1D(interval.getInf()));
final Vector3D end = line.toSpace((Point<Euclidean1D>) new Vector1D(interval.getSup()));
segments.add(new Segment(start, end, line));
}
return segments;
}
开发者ID:biocompibens,项目名称:SME,代码行数:29,代码来源:SubLine.java
示例9: addContribution
import org.apache.commons.math3.geometry.euclidean.oned.Interval; //导入依赖的package包/类
/** Add the contribution of a boundary facet.
* @param sub boundary facet
* @param node node containing segment
* @param splitters splitters for the boundary facet
* @param reversed if true, the facet has the inside on its plus side
*/
private void addContribution(final SubHyperplane<Euclidean2D> sub,
final BSPTree<Euclidean2D> node,
final Iterable<BSPTree<Euclidean2D>> splitters,
final boolean reversed) {
@SuppressWarnings("unchecked")
final AbstractSubHyperplane<Euclidean2D, Euclidean1D> absSub =
(AbstractSubHyperplane<Euclidean2D, Euclidean1D>) sub;
final Line line = (Line) sub.getHyperplane();
final List<Interval> intervals = ((IntervalsSet) absSub.getRemainingRegion()).asList();
for (final Interval i : intervals) {
// find the 2D points
final Vector2D startV = Double.isInfinite(i.getInf()) ?
null : (Vector2D) line.toSpace((Point<Euclidean1D>) new Vector1D(i.getInf()));
final Vector2D endV = Double.isInfinite(i.getSup()) ?
null : (Vector2D) line.toSpace((Point<Euclidean1D>) new Vector1D(i.getSup()));
// recover the connectivity information
final BSPTree<Euclidean2D> startN = selectClosest(startV, splitters);
final BSPTree<Euclidean2D> endN = selectClosest(endV, splitters);
if (reversed) {
segments.add(new ConnectableSegment(endV, startV, line.getReverse(),
node, endN, startN));
} else {
segments.add(new ConnectableSegment(startV, endV, line,
node, startN, endN));
}
}
}
开发者ID:biocompibens,项目名称:SME,代码行数:38,代码来源:PolygonsSet.java
示例10: testMultiple
import org.apache.commons.math3.geometry.euclidean.oned.Interval; //导入依赖的package包/类
@Test
public void testMultiple() {
RegionFactory<Euclidean1D> factory = new RegionFactory<Euclidean1D>();
IntervalsSet set = (IntervalsSet)
factory.intersection(factory.union(factory.difference(new IntervalsSet(1.0, 6.0, 1.0e-10),
new IntervalsSet(3.0, 5.0, 1.0e-10)),
new IntervalsSet(9.0, Double.POSITIVE_INFINITY, 1.0e-10)),
new IntervalsSet(Double.NEGATIVE_INFINITY, 11.0, 1.0e-10));
Assert.assertEquals(5.0, set.getSize(), 1.0e-10);
Assert.assertEquals(5.9, ((Vector1D) set.getBarycenter()).getX(), 1.0e-10);
Assert.assertEquals(Region.Location.OUTSIDE, set.checkPoint(new Vector1D(0.0)));
Assert.assertEquals(Region.Location.OUTSIDE, set.checkPoint(new Vector1D(4.0)));
Assert.assertEquals(Region.Location.OUTSIDE, set.checkPoint(new Vector1D(8.0)));
Assert.assertEquals(Region.Location.OUTSIDE, set.checkPoint(new Vector1D(12.0)));
Assert.assertEquals(Region.Location.INSIDE, set.checkPoint(new Vector1D(1.2)));
Assert.assertEquals(Region.Location.INSIDE, set.checkPoint(new Vector1D(5.9)));
Assert.assertEquals(Region.Location.INSIDE, set.checkPoint(new Vector1D(9.01)));
Assert.assertEquals(Region.Location.BOUNDARY, set.checkPoint(new Vector1D(5.0)));
Assert.assertEquals(Region.Location.BOUNDARY, set.checkPoint(new Vector1D(11.0)));
Assert.assertEquals( 1.0, set.getInf(), 1.0e-10);
Assert.assertEquals(11.0, set.getSup(), 1.0e-10);
List<Interval> list = set.asList();
Assert.assertEquals(3, list.size());
Assert.assertEquals( 1.0, list.get(0).getInf(), 1.0e-10);
Assert.assertEquals( 3.0, list.get(0).getSup(), 1.0e-10);
Assert.assertEquals( 5.0, list.get(1).getInf(), 1.0e-10);
Assert.assertEquals( 6.0, list.get(1).getSup(), 1.0e-10);
Assert.assertEquals( 9.0, list.get(2).getInf(), 1.0e-10);
Assert.assertEquals(11.0, list.get(2).getSup(), 1.0e-10);
}
开发者ID:Quanticol,项目名称:CARMA,代码行数:33,代码来源:IntervalsSetTest.java
示例11: getSegments
import org.apache.commons.math3.geometry.euclidean.oned.Interval; //导入依赖的package包/类
/** Get the endpoints of the sub-line.
* <p>
* A subline may be any arbitrary number of disjoints segments, so the endpoints
* are provided as a list of endpoint pairs. Each element of the list represents
* one segment, and each segment contains a start point at index 0 and an end point
* at index 1. If the sub-line is unbounded in the negative infinity direction,
* the start point of the first segment will have infinite coordinates. If the
* sub-line is unbounded in the positive infinity direction, the end point of the
* last segment will have infinite coordinates. So a sub-line covering the whole
* line will contain just one row and both elements of this row will have infinite
* coordinates. If the sub-line is empty, the returned list will contain 0 segments.
* </p>
* @return list of segments endpoints
*/
public List<Segment> getSegments() {
final List<Interval> list = remainingRegion.asList();
final List<Segment> segments = new ArrayList<Segment>();
for (final Interval interval : list) {
final Vector3D start = line.toSpace(new Vector1D(interval.getLower()));
final Vector3D end = line.toSpace(new Vector1D(interval.getUpper()));
segments.add(new Segment(start, end, line));
}
return segments;
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:29,代码来源:SubLine.java
示例12: testMultiple
import org.apache.commons.math3.geometry.euclidean.oned.Interval; //导入依赖的package包/类
@Test
public void testMultiple() {
RegionFactory<Euclidean1D> factory = new RegionFactory<Euclidean1D>();
IntervalsSet set = (IntervalsSet)
factory.intersection(factory.union(factory.difference(new IntervalsSet(1.0, 6.0),
new IntervalsSet(3.0, 5.0)),
new IntervalsSet(9.0, Double.POSITIVE_INFINITY)),
new IntervalsSet(Double.NEGATIVE_INFINITY, 11.0));
Assert.assertEquals(5.0, set.getSize(), 1.0e-10);
Assert.assertEquals(5.9, ((Vector1D) set.getBarycenter()).getX(), 1.0e-10);
Assert.assertEquals(Region.Location.OUTSIDE, set.checkPoint(new Vector1D(0.0)));
Assert.assertEquals(Region.Location.OUTSIDE, set.checkPoint(new Vector1D(4.0)));
Assert.assertEquals(Region.Location.OUTSIDE, set.checkPoint(new Vector1D(8.0)));
Assert.assertEquals(Region.Location.OUTSIDE, set.checkPoint(new Vector1D(12.0)));
Assert.assertEquals(Region.Location.INSIDE, set.checkPoint(new Vector1D(1.2)));
Assert.assertEquals(Region.Location.INSIDE, set.checkPoint(new Vector1D(5.9)));
Assert.assertEquals(Region.Location.INSIDE, set.checkPoint(new Vector1D(9.01)));
Assert.assertEquals(Region.Location.BOUNDARY, set.checkPoint(new Vector1D(5.0)));
Assert.assertEquals(Region.Location.BOUNDARY, set.checkPoint(new Vector1D(11.0)));
Assert.assertEquals( 1.0, set.getInf(), 1.0e-10);
Assert.assertEquals(11.0, set.getSup(), 1.0e-10);
List<Interval> list = set.asList();
Assert.assertEquals(3, list.size());
Assert.assertEquals( 1.0, list.get(0).getLower(), 1.0e-10);
Assert.assertEquals( 3.0, list.get(0).getUpper(), 1.0e-10);
Assert.assertEquals( 5.0, list.get(1).getLower(), 1.0e-10);
Assert.assertEquals( 6.0, list.get(1).getUpper(), 1.0e-10);
Assert.assertEquals( 9.0, list.get(2).getLower(), 1.0e-10);
Assert.assertEquals(11.0, list.get(2).getUpper(), 1.0e-10);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:33,代码来源:IntervalsSetTest.java
示例13: getSegments
import org.apache.commons.math3.geometry.euclidean.oned.Interval; //导入依赖的package包/类
/** Get the endpoints of the sub-line.
* <p>
* A subline may be any arbitrary number of disjoints segments, so the endpoints
* are provided as a list of endpoint pairs. Each element of the list represents
* one segment, and each segment contains a start point at index 0 and an end point
* at index 1. If the sub-line is unbounded in the negative infinity direction,
* the start point of the first segment will have infinite coordinates. If the
* sub-line is unbounded in the positive infinity direction, the end point of the
* last segment will have infinite coordinates. So a sub-line covering the whole
* line will contain just one row and both elements of this row will have infinite
* coordinates. If the sub-line is empty, the returned list will contain 0 segments.
* </p>
* @return list of segments endpoints
*/
public List<Segment> getSegments() {
final List<Interval> list = remainingRegion.asList();
final List<Segment> segments = new ArrayList<Segment>(list.size());
for (final Interval interval : list) {
final Vector3D start = line.toSpace(new Vector1D(interval.getInf()));
final Vector3D end = line.toSpace(new Vector1D(interval.getSup()));
segments.add(new Segment(start, end, line));
}
return segments;
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:29,代码来源:SubLine.java
示例14: testMultiple
import org.apache.commons.math3.geometry.euclidean.oned.Interval; //导入依赖的package包/类
@Test
public void testMultiple() {
RegionFactory<Euclidean1D> factory = new RegionFactory<Euclidean1D>();
IntervalsSet set = (IntervalsSet)
factory.intersection(factory.union(factory.difference(new IntervalsSet(1.0, 6.0),
new IntervalsSet(3.0, 5.0)),
new IntervalsSet(9.0, Double.POSITIVE_INFINITY)),
new IntervalsSet(Double.NEGATIVE_INFINITY, 11.0));
Assert.assertEquals(5.0, set.getSize(), 1.0e-10);
Assert.assertEquals(5.9, ((Vector1D) set.getBarycenter()).getX(), 1.0e-10);
Assert.assertEquals(Region.Location.OUTSIDE, set.checkPoint(new Vector1D(0.0)));
Assert.assertEquals(Region.Location.OUTSIDE, set.checkPoint(new Vector1D(4.0)));
Assert.assertEquals(Region.Location.OUTSIDE, set.checkPoint(new Vector1D(8.0)));
Assert.assertEquals(Region.Location.OUTSIDE, set.checkPoint(new Vector1D(12.0)));
Assert.assertEquals(Region.Location.INSIDE, set.checkPoint(new Vector1D(1.2)));
Assert.assertEquals(Region.Location.INSIDE, set.checkPoint(new Vector1D(5.9)));
Assert.assertEquals(Region.Location.INSIDE, set.checkPoint(new Vector1D(9.01)));
Assert.assertEquals(Region.Location.BOUNDARY, set.checkPoint(new Vector1D(5.0)));
Assert.assertEquals(Region.Location.BOUNDARY, set.checkPoint(new Vector1D(11.0)));
Assert.assertEquals( 1.0, set.getInf(), 1.0e-10);
Assert.assertEquals(11.0, set.getSup(), 1.0e-10);
List<Interval> list = set.asList();
Assert.assertEquals(3, list.size());
Assert.assertEquals( 1.0, list.get(0).getInf(), 1.0e-10);
Assert.assertEquals( 3.0, list.get(0).getSup(), 1.0e-10);
Assert.assertEquals( 5.0, list.get(1).getInf(), 1.0e-10);
Assert.assertEquals( 6.0, list.get(1).getSup(), 1.0e-10);
Assert.assertEquals( 9.0, list.get(2).getInf(), 1.0e-10);
Assert.assertEquals(11.0, list.get(2).getSup(), 1.0e-10);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:33,代码来源:IntervalsSetTest.java
示例15: getSegments
import org.apache.commons.math3.geometry.euclidean.oned.Interval; //导入依赖的package包/类
/** Get the endpoints of the sub-line.
* <p>
* A subline may be any arbitrary number of disjoints segments, so the endpoints
* are provided as a list of endpoint pairs. Each element of the list represents
* one segment, and each segment contains a start point at index 0 and an end point
* at index 1. If the sub-line is unbounded in the negative infinity direction,
* the start point of the first segment will have infinite coordinates. If the
* sub-line is unbounded in the positive infinity direction, the end point of the
* last segment will have infinite coordinates. So a sub-line covering the whole
* line will contain just one row and both elements of this row will have infinite
* coordinates. If the sub-line is empty, the returned list will contain 0 segments.
* </p>
* @return list of segments endpoints
*/
public List<Segment> getSegments() {
final List<Interval> list = remainingRegion.asList();
final List<Segment> segments = new ArrayList<Segment>();
for (final Interval interval : list) {
final Vector3D start = line.toSpace(new Vector1D(interval.getInf()));
final Vector3D end = line.toSpace(new Vector1D(interval.getSup()));
segments.add(new Segment(start, end, line));
}
return segments;
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:29,代码来源:SubLine.java
示例16: testGridSearch
import org.apache.commons.math3.geometry.euclidean.oned.Interval; //导入依赖的package包/类
@Test
public void testGridSearch() {
Interval interval = Solver.gridSearch(new Parabola(0.25), 0.0, 1.0, 0.1);
assertEquals(Precision.compareTo(interval.getInf(), 0.1, 1), 0);
assertEquals(Precision.compareTo(interval.getSup(), 0.3, 1), 0);
interval = Solver.gridSearch(new Parabola(1.2), 0.0, 1.0, 0.1);
assertEquals(Precision.compareTo(interval.getInf(), 0.9, 1), 0);
assertEquals(Precision.compareTo(interval.getSup(), 1.0, 1), 0);
interval = Solver.gridSearch(new Parabola(1.2), 0.0, 1.0, 0.3);
assertEquals(Precision.compareTo(interval.getInf(), 0.9, 1), 0);
assertEquals(Precision.compareTo(interval.getSup(), 1.0, 1), 0);
}
开发者ID:googlegenomics,项目名称:dataflow-java,代码行数:15,代码来源:SolverTest.java
示例17: testLineIntersection
import org.apache.commons.math3.geometry.euclidean.oned.Interval; //导入依赖的package包/类
@Test
public void testLineIntersection() {
Vector2D[][] vertices = new Vector2D[][] {
new Vector2D[] {
new Vector2D( 0.0, 0.0),
new Vector2D( 2.0, 0.0),
new Vector2D( 2.0, 1.0),
new Vector2D( 3.0, 1.0),
new Vector2D( 3.0, 3.0),
new Vector2D( 1.0, 3.0),
new Vector2D( 1.0, 2.0),
new Vector2D( 0.0, 2.0)
}
};
PolygonsSet set = buildSet(vertices);
Line l1 = new Line(new Vector2D(-1.5, 0.0), FastMath.PI / 4, 1.0e-10);
SubLine s1 = (SubLine) set.intersection(l1.wholeHyperplane());
List<Interval> i1 = ((IntervalsSet) s1.getRemainingRegion()).asList();
Assert.assertEquals(2, i1.size());
Interval v10 = i1.get(0);
Vector2D p10Lower = l1.toSpace(new Vector1D(v10.getInf()));
Assert.assertEquals(0.0, p10Lower.getX(), 1.0e-10);
Assert.assertEquals(1.5, p10Lower.getY(), 1.0e-10);
Vector2D p10Upper = l1.toSpace(new Vector1D(v10.getSup()));
Assert.assertEquals(0.5, p10Upper.getX(), 1.0e-10);
Assert.assertEquals(2.0, p10Upper.getY(), 1.0e-10);
Interval v11 = i1.get(1);
Vector2D p11Lower = l1.toSpace(new Vector1D(v11.getInf()));
Assert.assertEquals(1.0, p11Lower.getX(), 1.0e-10);
Assert.assertEquals(2.5, p11Lower.getY(), 1.0e-10);
Vector2D p11Upper = l1.toSpace(new Vector1D(v11.getSup()));
Assert.assertEquals(1.5, p11Upper.getX(), 1.0e-10);
Assert.assertEquals(3.0, p11Upper.getY(), 1.0e-10);
Line l2 = new Line(new Vector2D(-1.0, 2.0), 0, 1.0e-10);
SubLine s2 = (SubLine) set.intersection(l2.wholeHyperplane());
List<Interval> i2 = ((IntervalsSet) s2.getRemainingRegion()).asList();
Assert.assertEquals(1, i2.size());
Interval v20 = i2.get(0);
Vector2D p20Lower = l2.toSpace(new Vector1D(v20.getInf()));
Assert.assertEquals(1.0, p20Lower.getX(), 1.0e-10);
Assert.assertEquals(2.0, p20Lower.getY(), 1.0e-10);
Vector2D p20Upper = l2.toSpace(new Vector1D(v20.getSup()));
Assert.assertEquals(3.0, p20Upper.getX(), 1.0e-10);
Assert.assertEquals(2.0, p20Upper.getY(), 1.0e-10);
}
开发者ID:Quanticol,项目名称:CARMA,代码行数:49,代码来源:PolygonsSetTest.java
示例18: testLineIntersection
import org.apache.commons.math3.geometry.euclidean.oned.Interval; //导入依赖的package包/类
@Test
public void testLineIntersection() {
Vector2D[][] vertices = new Vector2D[][] {
new Vector2D[] {
new Vector2D( 0.0, 0.0),
new Vector2D( 2.0, 0.0),
new Vector2D( 2.0, 1.0),
new Vector2D( 3.0, 1.0),
new Vector2D( 3.0, 3.0),
new Vector2D( 1.0, 3.0),
new Vector2D( 1.0, 2.0),
new Vector2D( 0.0, 2.0)
}
};
PolygonsSet set = buildSet(vertices);
Line l1 = new Line(new Vector2D(-1.5, 0.0), FastMath.PI / 4);
SubLine s1 = (SubLine) set.intersection(l1.wholeHyperplane());
List<Interval> i1 = ((IntervalsSet) s1.getRemainingRegion()).asList();
Assert.assertEquals(2, i1.size());
Interval v10 = i1.get(0);
Vector2D p10Lower = l1.toSpace(new Vector1D(v10.getLower()));
Assert.assertEquals(0.0, p10Lower.getX(), 1.0e-10);
Assert.assertEquals(1.5, p10Lower.getY(), 1.0e-10);
Vector2D p10Upper = l1.toSpace(new Vector1D(v10.getUpper()));
Assert.assertEquals(0.5, p10Upper.getX(), 1.0e-10);
Assert.assertEquals(2.0, p10Upper.getY(), 1.0e-10);
Interval v11 = i1.get(1);
Vector2D p11Lower = l1.toSpace(new Vector1D(v11.getLower()));
Assert.assertEquals(1.0, p11Lower.getX(), 1.0e-10);
Assert.assertEquals(2.5, p11Lower.getY(), 1.0e-10);
Vector2D p11Upper = l1.toSpace(new Vector1D(v11.getUpper()));
Assert.assertEquals(1.5, p11Upper.getX(), 1.0e-10);
Assert.assertEquals(3.0, p11Upper.getY(), 1.0e-10);
Line l2 = new Line(new Vector2D(-1.0, 2.0), 0);
SubLine s2 = (SubLine) set.intersection(l2.wholeHyperplane());
List<Interval> i2 = ((IntervalsSet) s2.getRemainingRegion()).asList();
Assert.assertEquals(1, i2.size());
Interval v20 = i2.get(0);
Vector2D p20Lower = l2.toSpace(new Vector1D(v20.getLower()));
Assert.assertEquals(1.0, p20Lower.getX(), 1.0e-10);
Assert.assertEquals(2.0, p20Lower.getY(), 1.0e-10);
Vector2D p20Upper = l2.toSpace(new Vector1D(v20.getUpper()));
Assert.assertEquals(3.0, p20Upper.getX(), 1.0e-10);
Assert.assertEquals(2.0, p20Upper.getY(), 1.0e-10);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:49,代码来源:PolygonsSetTest.java
示例19: testLineIntersection
import org.apache.commons.math3.geometry.euclidean.oned.Interval; //导入依赖的package包/类
@Test
public void testLineIntersection() {
Vector2D[][] vertices = new Vector2D[][] {
new Vector2D[] {
new Vector2D( 0.0, 0.0),
new Vector2D( 2.0, 0.0),
new Vector2D( 2.0, 1.0),
new Vector2D( 3.0, 1.0),
new Vector2D( 3.0, 3.0),
new Vector2D( 1.0, 3.0),
new Vector2D( 1.0, 2.0),
new Vector2D( 0.0, 2.0)
}
};
PolygonsSet set = buildSet(vertices);
Line l1 = new Line(new Vector2D(-1.5, 0.0), FastMath.PI / 4);
SubLine s1 = (SubLine) set.intersection(l1.wholeHyperplane());
List<Interval> i1 = ((IntervalsSet) s1.getRemainingRegion()).asList();
Assert.assertEquals(2, i1.size());
Interval v10 = i1.get(0);
Vector2D p10Lower = l1.toSpace(new Vector1D(v10.getInf()));
Assert.assertEquals(0.0, p10Lower.getX(), 1.0e-10);
Assert.assertEquals(1.5, p10Lower.getY(), 1.0e-10);
Vector2D p10Upper = l1.toSpace(new Vector1D(v10.getSup()));
Assert.assertEquals(0.5, p10Upper.getX(), 1.0e-10);
Assert.assertEquals(2.0, p10Upper.getY(), 1.0e-10);
Interval v11 = i1.get(1);
Vector2D p11Lower = l1.toSpace(new Vector1D(v11.getInf()));
Assert.assertEquals(1.0, p11Lower.getX(), 1.0e-10);
Assert.assertEquals(2.5, p11Lower.getY(), 1.0e-10);
Vector2D p11Upper = l1.toSpace(new Vector1D(v11.getSup()));
Assert.assertEquals(1.5, p11Upper.getX(), 1.0e-10);
Assert.assertEquals(3.0, p11Upper.getY(), 1.0e-10);
Line l2 = new Line(new Vector2D(-1.0, 2.0), 0);
SubLine s2 = (SubLine) set.intersection(l2.wholeHyperplane());
List<Interval> i2 = ((IntervalsSet) s2.getRemainingRegion()).asList();
Assert.assertEquals(1, i2.size());
Interval v20 = i2.get(0);
Vector2D p20Lower = l2.toSpace(new Vector1D(v20.getInf()));
Assert.assertEquals(1.0, p20Lower.getX(), 1.0e-10);
Assert.assertEquals(2.0, p20Lower.getY(), 1.0e-10);
Vector2D p20Upper = l2.toSpace(new Vector1D(v20.getSup()));
Assert.assertEquals(3.0, p20Upper.getX(), 1.0e-10);
Assert.assertEquals(2.0, p20Upper.getY(), 1.0e-10);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:49,代码来源:PolygonsSetTest.java
注:本文中的org.apache.commons.math3.geometry.euclidean.oned.Interval类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论