当前位置: 首页>>代码示例>>Java>>正文


Java Interval类代码示例

本文整理汇总了Java中org.apache.commons.math3.geometry.euclidean.oned.Interval的典型用法代码示例。如果您正苦于以下问题:Java Interval类的具体用法?Java Interval怎么用?Java Interval使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Interval类属于org.apache.commons.math3.geometry.euclidean.oned包,在下文中一共展示了Interval类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的org.apache.commons.math3.geometry.euclidean.oned.Interval类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。