/** {@inheritDoc} */ public Vector1D subtract(Vector<Euclidean1D> p) { Vector1D p3 = (Vector1D) p; return new Vector1D(x - p3.x); }
/** {@inheritDoc} */ public Vector1D negate() { return new Vector1D(-x); }
/** {@inheritDoc} */ public Vector1D scalarMultiply(double a) { return new Vector1D(a * x); }
/** Build a finite point. * @param x abscissa of the point * @return a new point for finite abscissa, null otherwise */ private Vector1D finiteOrNullPoint(final double x) { return Double.isInfinite(x) ? null : new Vector1D(x); }
/** {@inheritDoc} * @see #getAbscissa(Vector3D) */ public Vector1D toSubSpace(final Point<Euclidean3D> point) { return new Vector1D(getAbscissa((Vector3D) point)); }
/** {@inheritDoc} */ public Vector1D add(Vector<Euclidean1D> v) { Vector1D v1 = (Vector1D) v; return new Vector1D(x + v1.getX()); }
/** {@inheritDoc} */ public Vector1D subtract(double factor, Vector<Euclidean1D> v) { Vector1D v1 = (Vector1D) v; return new Vector1D(x - factor * v1.getX()); }
/** {@inheritDoc} */ @Override public Vector1D parse(final String source, final ParsePosition pos) { final double[] coordinates = parseCoordinates(1, source, pos); if (coordinates == null) { return null; } return new Vector1D(coordinates[0]); }
/** {@inheritDoc} */ public Vector1D add(double factor, Vector<Euclidean1D> v) { Vector1D v1 = (Vector1D) v; return new Vector1D(x + factor * v1.getX()); }
/** {@inheritDoc} */ public Vector1D toSubSpace(final Point<Euclidean2D> point) { Vector2D p2 = (Vector2D) point; return new Vector1D(MathArrays.linearCombination(cos, p2.getX(), sin, p2.getY())); }
/** 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; }
/** 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; }
new OrientedPoint(new Vector1D(upper), true, tolerance).wholeHyperplane(); return new BSPTree<Euclidean1D>(upperCut, new BSPTree<Euclidean1D>(Boolean.FALSE), new OrientedPoint(new Vector1D(lower), false, tolerance).wholeHyperplane(); if (Double.isInfinite(upper) && (upper > 0)) { new OrientedPoint(new Vector1D(upper), true, tolerance).wholeHyperplane(); return new BSPTree<Euclidean1D>(lowerCut, new BSPTree<Euclidean1D>(Boolean.FALSE),
vertices[i++] = new Vector2D[] { null, line.toSpace((Point<Euclidean1D>) new Vector1D(-Float.MAX_VALUE)), line.toSpace((Point<Euclidean1D>) new Vector1D(+Float.MAX_VALUE)) }; } else if (loop.get(0).getStart() == null) { x -= FastMath.max(1.0, FastMath.abs(x / 2)); array[j++] = null; array[j++] = segment.getLine().toSpace((Point<Euclidean1D>) new Vector1D(x)); array[j++] = segment.getLine().toSpace((Point<Euclidean1D>) new Vector1D(x));
/** {@inheritDoc} */ @Override protected void computeGeometricalProperties() { if (getTree(false).getCut() == null) { setBarycenter((Point<Euclidean1D>) Vector1D.NaN); setSize(((Boolean) getTree(false).getAttribute()) ? Double.POSITIVE_INFINITY : 0); } else { double size = 0.0; double sum = 0.0; for (final Interval interval : asList()) { size += interval.getSize(); sum += interval.getSize() * interval.getBarycenter(); } setSize(size); if (Double.isInfinite(size)) { setBarycenter((Point<Euclidean1D>) Vector1D.NaN); } else if (size >= Precision.SAFE_MIN) { setBarycenter((Point<Euclidean1D>) new Vector1D(sum / size)); } else { setBarycenter((Point<Euclidean1D>) ((OrientedPoint) getTree(false).getCut().getHyperplane()).getLocation()); } } }
/** {@inheritDoc} */ public Vector1D subtract(Vector<Euclidean1D> p) { Vector1D p3 = (Vector1D) p; return new Vector1D(x - p3.x); }
/** {@inheritDoc} */ public Vector1D add(double factor, Vector<Euclidean1D> v) { Vector1D v1 = (Vector1D) v; return new Vector1D(x + factor * v1.getX()); }
/** {@inheritDoc} */ public Vector1D subtract(double factor, Vector<Euclidean1D> v) { Vector1D v1 = (Vector1D) v; return new Vector1D(x - factor * v1.getX()); }
/** {@inheritDoc} */ public Vector1D toSubSpace(final Point<Euclidean2D> point) { Vector2D p2 = (Vector2D) point; return new Vector1D(MathArrays.linearCombination(cos, p2.getX(), sin, p2.getY())); }