• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java Vector1D类的典型用法和代码示例

java 1次浏览

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

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

示例1: getSegments

点赞 3

import org.apache.commons.math3.geometry.euclidean.oned.Vector1D; //导入依赖的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: side

点赞 3

import org.apache.commons.math3.geometry.euclidean.oned.Vector1D; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public Side side(final Hyperplane<Euclidean2D> hyperplane) {

    final Line    thisLine  = (Line) getHyperplane();
    final Line    otherLine = (Line) hyperplane;
    final Vector2D crossing  = thisLine.intersection(otherLine);

    if (crossing == null) {
        // the lines are parallel,
        final double global = otherLine.getOffset(thisLine);
        return (global < -1.0e-10) ? Side.MINUS : ((global > 1.0e-10) ? Side.PLUS : Side.HYPER);
    }

    // the lines do intersect
    final boolean direct = FastMath.sin(thisLine.getAngle() - otherLine.getAngle()) < 0;
    final Vector1D x = thisLine.toSubSpace((Point<Euclidean2D>) crossing);
    return getRemainingRegion().side(new OrientedPoint(x, direct, thisLine.getTolerance()));

}
 

开发者ID:Quanticol,
项目名称:CARMA,
代码行数:21,
代码来源:SubLine.java

示例3: getSegments

点赞 3

import org.apache.commons.math3.geometry.euclidean.oned.Vector1D; //导入依赖的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

示例4: side

点赞 3

import org.apache.commons.math3.geometry.euclidean.oned.Vector1D; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public Side side(final Hyperplane<Euclidean2D> hyperplane) {

    final Line    thisLine  = (Line) getHyperplane();
    final Line    otherLine = (Line) hyperplane;
    final Vector2D crossing  = thisLine.intersection(otherLine);

    if (crossing == null) {
        // the lines are parallel,
        final double global = otherLine.getOffset(thisLine);
        return (global < -1.0e-10) ? Side.MINUS : ((global > 1.0e-10) ? Side.PLUS : Side.HYPER);
    }

    // the lines do intersect
    final boolean direct = FastMath.sin(thisLine.getAngle() - otherLine.getAngle()) < 0;
    final Vector1D x = thisLine.toSubSpace(crossing);
    return getRemainingRegion().side(new OrientedPoint(x, direct));

}
 

开发者ID:SpoonLabs,
项目名称:astor,
代码行数:21,
代码来源:SubLine.java

示例5: addContribution

点赞 3

import org.apache.commons.math3.geometry.euclidean.oned.Vector1D; //导入依赖的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

示例6: getSegments

点赞 3

import org.apache.commons.math3.geometry.euclidean.oned.Vector1D; //导入依赖的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

示例7: addContribution

点赞 3

import org.apache.commons.math3.geometry.euclidean.oned.Vector1D; //导入依赖的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

示例8: getSegments

点赞 3

import org.apache.commons.math3.geometry.euclidean.oned.Vector1D; //导入依赖的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

示例9: getSegments

点赞 2

import org.apache.commons.math3.geometry.euclidean.oned.Vector1D; //导入依赖的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

示例10: intersection

点赞 2

import org.apache.commons.math3.geometry.euclidean.oned.Vector1D; //导入依赖的package包/类
/** Get the intersection of a line with the instance.
 * @param line line intersecting the instance
 * @return intersection point between between the line and the
 * instance (null if the line is parallel to the instance)
 */
public Vector3D intersection(final Line line) {
    final Vector3D direction = line.getDirection();
    final double   dot       = w.dotProduct(direction);
    if (FastMath.abs(dot) < 1.0e-10) {
        return null;
    }
    final Vector3D point = line.toSpace((Point<Euclidean1D>) Vector1D.ZERO);
    final double   k     = -(originOffset + w.dotProduct(point)) / dot;
    return new Vector3D(1.0, point, k, direction);
}
 

开发者ID:biocompibens,
项目名称:SME,
代码行数:16,
代码来源:Plane.java

示例11: getPointAt

点赞 2

import org.apache.commons.math3.geometry.euclidean.oned.Vector1D; //导入依赖的package包/类
/** Get one point from the plane.
 * @param abscissa desired abscissa for the point
 * @param offset desired offset for the point
 * @return one point in the plane, with given abscissa and offset
 * relative to the line
 */
public Vector2D getPointAt(final Vector1D abscissa, final double offset) {
    final double x       = abscissa.getX();
    final double dOffset = offset - originOffset;
    return new Vector2D(MathArrays.linearCombination(x, cos,  dOffset, sin),
                        MathArrays.linearCombination(x, sin, -dOffset, cos));
}
 

开发者ID:biocompibens,
项目名称:SME,
代码行数:13,
代码来源:Line.java

示例12: apply

点赞 2

import org.apache.commons.math3.geometry.euclidean.oned.Vector1D; //导入依赖的package包/类
/** {@inheritDoc} */
public SubHyperplane<Euclidean1D> apply(final SubHyperplane<Euclidean1D> sub,
                                        final Hyperplane<Euclidean2D> original,
                                        final Hyperplane<Euclidean2D> transformed) {
    final OrientedPoint op     = (OrientedPoint) sub.getHyperplane();
    final Line originalLine    = (Line) original;
    final Line transformedLine = (Line) transformed;
    final Vector1D newLoc =
        transformedLine.toSubSpace(apply(originalLine.toSpace(op.getLocation())));
    return new OrientedPoint(newLoc, op.isDirect(), originalLine.tolerance).wholeHyperplane();
}
 

开发者ID:biocompibens,
项目名称:SME,
代码行数:12,
代码来源:Line.java

示例13: addContribution

点赞 2

import org.apache.commons.math3.geometry.euclidean.oned.Vector1D; //导入依赖的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

示例14: side

点赞 2

import org.apache.commons.math3.geometry.euclidean.oned.Vector1D; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public Side side(Hyperplane<Euclidean3D> hyperplane) {

    final Plane otherPlane = (Plane) hyperplane;
    final Plane thisPlane  = (Plane) getHyperplane();
    final Line  inter      = otherPlane.intersection(thisPlane);
    final double tolerance = thisPlane.getTolerance();

    if (inter == null) {
        // the hyperplanes are parallel,
        // any point can be used to check their relative position
        final double global = otherPlane.getOffset(thisPlane);
        return (global < -1.0e-10) ? Side.MINUS : ((global > 1.0e-10) ? Side.PLUS : Side.HYPER);
    }

    // create a 2D line in the otherPlane canonical 2D frame such that:
    //   - the line is the crossing line of the two planes in 3D
    //   - the line splits the otherPlane in two half planes with an
    //     orientation consistent with the orientation of the instance
    //     (i.e. the 3D half space on the plus side (resp. minus side)
    //      of the instance contains the 2D half plane on the plus side
    //      (resp. minus side) of the 2D line
    Vector2D p = thisPlane.toSubSpace((Point<Euclidean3D>) inter.toSpace((Point<Euclidean1D>) Vector1D.ZERO));
    Vector2D q = thisPlane.toSubSpace((Point<Euclidean3D>) inter.toSpace((Point<Euclidean1D>) Vector1D.ONE));
    Vector3D crossP = Vector3D.crossProduct(inter.getDirection(), thisPlane.getNormal());
    if (crossP.dotProduct(otherPlane.getNormal()) < 0) {
        final Vector2D tmp = p;
        p           = q;
        q           = tmp;
    }
    final org.apache.commons.math3.geometry.euclidean.twod.Line line2D =
        new org.apache.commons.math3.geometry.euclidean.twod.Line(p, q, tolerance);

    // check the side on the 2D plane
    return getRemainingRegion().side(line2D);

}
 

开发者ID:Quanticol,
项目名称:CARMA,
代码行数:39,
代码来源:SubPlane.java

示例15: split

点赞 2

import org.apache.commons.math3.geometry.euclidean.oned.Vector1D; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public SplitSubHyperplane<Euclidean2D> split(final Hyperplane<Euclidean2D> hyperplane) {

    final Line    thisLine  = (Line) getHyperplane();
    final Line    otherLine = (Line) hyperplane;
    final Vector2D crossing = thisLine.intersection(otherLine);
    final double tolerance  = thisLine.getTolerance();

    if (crossing == null) {
        // the lines are parallel
        final double global = otherLine.getOffset(thisLine);
        return (global < -1.0e-10) ?
               new SplitSubHyperplane<Euclidean2D>(null, this) :
               new SplitSubHyperplane<Euclidean2D>(this, null);
    }

    // the lines do intersect
    final boolean direct = FastMath.sin(thisLine.getAngle() - otherLine.getAngle()) < 0;
    final Vector1D x      = thisLine.toSubSpace((Point<Euclidean2D>) crossing);
    final SubHyperplane<Euclidean1D> subPlus  =
            new OrientedPoint(x, !direct, tolerance).wholeHyperplane();
    final SubHyperplane<Euclidean1D> subMinus =
            new OrientedPoint(x,  direct, tolerance).wholeHyperplane();

    final BSPTree<Euclidean1D> splitTree = getRemainingRegion().getTree(false).split(subMinus);
    final BSPTree<Euclidean1D> plusTree  = getRemainingRegion().isEmpty(splitTree.getPlus()) ?
                                           new BSPTree<Euclidean1D>(Boolean.FALSE) :
                                           new BSPTree<Euclidean1D>(subPlus, new BSPTree<Euclidean1D>(Boolean.FALSE),
                                                                    splitTree.getPlus(), null);
    final BSPTree<Euclidean1D> minusTree = getRemainingRegion().isEmpty(splitTree.getMinus()) ?
                                           new BSPTree<Euclidean1D>(Boolean.FALSE) :
                                           new BSPTree<Euclidean1D>(subMinus, new BSPTree<Euclidean1D>(Boolean.FALSE),
                                                                    splitTree.getMinus(), null);

    return new SplitSubHyperplane<Euclidean2D>(new SubLine(thisLine.copySelf(), new IntervalsSet(plusTree, tolerance)),
                                               new SubLine(thisLine.copySelf(), new IntervalsSet(minusTree, tolerance)));

}
 

开发者ID:Quanticol,
项目名称:CARMA,
代码行数:40,
代码来源:SubLine.java

示例16: testInterval

点赞 2

import org.apache.commons.math3.geometry.euclidean.oned.Vector1D; //导入依赖的package包/类
@Test
public void testInterval() {
    IntervalsSet set = new IntervalsSet(2.3, 5.7, 1.0e-10);
    Assert.assertEquals(3.4, set.getSize(), 1.0e-10);
    Assert.assertEquals(4.0, ((Vector1D) set.getBarycenter()).getX(), 1.0e-10);
    Assert.assertEquals(Region.Location.BOUNDARY, set.checkPoint(new Vector1D(2.3)));
    Assert.assertEquals(Region.Location.BOUNDARY, set.checkPoint(new Vector1D(5.7)));
    Assert.assertEquals(Region.Location.OUTSIDE,  set.checkPoint(new Vector1D(1.2)));
    Assert.assertEquals(Region.Location.OUTSIDE,  set.checkPoint(new Vector1D(8.7)));
    Assert.assertEquals(Region.Location.INSIDE,   set.checkPoint(new Vector1D(3.0)));
    Assert.assertEquals(2.3, set.getInf(), 1.0e-10);
    Assert.assertEquals(5.7, set.getSup(), 1.0e-10);
}
 

开发者ID:Quanticol,
项目名称:CARMA,
代码行数:14,
代码来源:IntervalsSetTest.java

示例17: testMultiple

点赞 2

import org.apache.commons.math3.geometry.euclidean.oned.Vector1D; //导入依赖的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

示例18: testPointAt

点赞 2

import org.apache.commons.math3.geometry.euclidean.oned.Vector1D; //导入依赖的package包/类
@Test
public void testPointAt() {
    Line l = new Line(new Vector2D(2, 1), new Vector2D(-2, -2), 1.0e-10);
    for (double a = -2.0; a < 2.0; a += 0.2) {
        Point<Euclidean1D> pA = new Vector1D(a);
        Point<Euclidean2D> point = l.toSpace(pA);
        Assert.assertEquals(a, (l.toSubSpace(point)).getX(), 1.0e-10);
        Assert.assertEquals(0.0, l.getOffset(point),   1.0e-10);
        for (double o = -2.0; o < 2.0; o += 0.2) {
            point = l.getPointAt((Vector1D) pA, o);
            Assert.assertEquals(a, (l.toSubSpace(point)).getX(), 1.0e-10);
            Assert.assertEquals(o, l.getOffset(point),   1.0e-10);
        }
    }
}
 

开发者ID:Quanticol,
项目名称:CARMA,
代码行数:16,
代码来源:LineTest.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)