Package net.algart.math

Examples of net.algart.math.Point


                && ((UniformGridPattern) pattern).isActuallyRectangular())
            {
                UniformGridPattern ugPattern = (UniformGridPattern) pattern;
                ugPattern = new BasicRectangularPattern(ugPattern.originOfGrid(), ugPattern.stepsOfGrid(),
                    ugPattern.gridIndexArea().ranges());
                Point steps = Point.valueOf(ugPattern.stepsOfGrid());
                UniformGridPattern previousSummand = rectangularSummands.get(steps);
                pattern = previousSummand == null ? ugPattern : previousSummand.minkowskiAdd(ugPattern);
                if (!(pattern instanceof BasicRectangularPattern))
                    throw new AssertionError("Invalid RectangularUniformGridPattern.minkowskiAdd implementation");
                rectangularSummands.put(steps, (BasicRectangularPattern) pattern);
View Full Code Here


        private final RectangularArea[] areas;

        private ShiftWeighedStitchingFunc(List<? extends Frame<P>> frames) {
            this.areas = new RectangularArea[frames.size()];
            int n = 0;
            Point shiftMinus05 = null;
            for (Frame<P> frame : frames) {
                RectangularArea area = ShiftFramePosition.area(
                    frame.position().area().min(), frame.matrix().dimensions());
                // important: we should not use frame.position().area() here, because it can be too large
                if (shiftMinus05 == null) {
View Full Code Here

            throw new NullPointerException("Null maxSurface argument");
        if (lastCoordinateStep <= 0.0)
            throw new IllegalArgumentException("Zero or negative last step of the grid is not allowed");
        final int dimCount = projection.dimCount();
        final Set<IPoint> projectionIndexes = projection.gridIndexes();
        final Point projectionOrigin = projection.originOfGrid();
        final double[] projectionSteps = projection.stepsOfGrid();
        double[] origin = new double[dimCount + 1];
        projectionOrigin.coordinates(origin);
        origin[dimCount] = lastCoordinateOfOrigin;
        double[] steps = new double[dimCount + 1];
        System.arraycopy(projectionSteps, 0, steps, 0, dimCount);
        steps[dimCount] = lastCoordinateStep;
        Set<IPoint> resultIndexes = new HashSet<IPoint>();
View Full Code Here

            Frame<P> singleFrame = actualFrames.get(0);
            Matrix<? extends PArray> m = singleFrame.matrix();
            FramePosition p = singleFrame.position();
            if (integerShiftPositions) {
//                System.out.println("1 frame branch: integer coordinates");
                Point o = p.area().min();
                IPoint localOffset = o.toRoundedPoint();
                assert o.equals(localOffset.toPoint());
                Matrix<T> casted = Matrices.asFuncMatrix(Func.IDENTITY, requiredType, m);
                // - must be before subMatr, if requiredType allows outsideValue, but the source matrix does not
                return casted.subMatr(localOffset.symmetric().coordinates(), dimensions,
                    Matrix.ContinuationMode.getConstantMode(outsideValue(actualFrames)));
            }
            if (p instanceof UniversalFramePosition
                && ((UniversalFramePosition)p).inverseTransform() instanceof LinearOperator)
            {
                LinearOperator inverseTransform = (LinearOperator)((UniversalFramePosition)p).inverseTransform();
//                System.out.println("1 frame branch: linear operator " + inverseTransform);
                LinearOperator shift = LinearOperator.getShiftInstance(area.min().coordinates());
                LinearOperator lo = shift.superposition(inverseTransform);
                Func f = Matrices.asInterpolationFunc(m, Matrices.InterpolationMethod.POLYLINEAR_FUNCTION,
                    outsideValue(actualFrames));
                f = lo.apply(f);
                return Matrices.asCoordFuncMatrix(f, requiredType, dimensions);
            }
        }
        if (integerShiftPositions && stitchingMethod instanceof CoordinateFreeStitchingMethod<?>) {
//            System.out.println("coordinate free branch: combining submatrices");
            // optimization: here we can just create corresponded submatrices
            List<Matrix<? extends PArray>> expandedMatrices =
                new ArrayList<Matrix<? extends PArray>>(actualFrames.size());
            for (Frame<P> localFrame : actualFrames) {
                Point o = localFrame.position().area().min();
                IPoint localOffset = o.toRoundedPoint();
                assert o.equals(localOffset.toPoint());
                Matrix<? extends PArray> m = localFrame.matrix();
                m = Matrices.asFuncMatrix(Func.IDENTITY, DoubleArray.class, m);
                // - we need Double virtual matrix to provide correct NaN values to the combining function
                m = m.subMatr(localOffset.symmetric().coordinates(), dimensions, Matrix.ContinuationMode.NAN_CONSTANT);
                expandedMatrices.add(m);
View Full Code Here

        return "Stitcher by " + stitchingMethod + " of " + frames.size() + " frames";
    }

    public static <P extends FramePosition> boolean integerOffsets(List<Frame<P>> frames, Point offset) {
        for (Frame<?> frame : frames) {
            Point o = frame.position().area().min().subtract(offset);
            if (!o.equals(o.toRoundedPoint().toPoint())) {
                return false;
            }
        }
        return true;
    }
View Full Code Here

            throw new NullPointerException("Null points argument");
        int n = points.size();
        if (n == 0)
            throw new IllegalArgumentException("Empty points set");
        Iterator<Point> iterator = points.iterator();
        Point p = iterator.next();
        if (p == null)
            throw new NullPointerException("Null point is the collection");
        int result = p.coordCount();
        for (; iterator.hasNext(); ) {
            p = iterator.next();
            if (p == null)
                throw new NullPointerException("Null point is the collection");
            if (p.coordCount() != result)
                throw new IllegalArgumentException("Points dimensions mismatch: the first point has "
                    + result + " coordinates, but some of points has " + p.coordCount());
            checkPoint(p);
        }
        return result;
    }
View Full Code Here

                // and providing a correct, non-shifted pattern for the quick algorithm
                rectEndOrStart = IPoint.origin(ptn.dimCount());
                normalized = ptn;
                minkowskiIncrement = null;
            } else {
                Point preciseRectEndOrStart = negativeSegments ? ptn.coordMax() : ptn.coordMin();
                assert preciseRectEndOrStart.isInteger();
                // - this method is called only in union-decomposition mode,
                // which is not used for non-integer or (N+1)-dimensional patterns
                rectEndOrStart = preciseRectEndOrStart.toRoundedPoint();
                normalized = ptn.shift(rectEndOrStart.symmetric().toPoint());
                // normalized segment has origin at the left or right end:
                // so minkowskiIncrement will consists of little positive / negative points
                // that provide good (small) leftward / rightward shifts
                minkowskiIncrement = lastNormalized == null ?
View Full Code Here

        private UniversalWeighedStitchingFunc(List<? extends Frame<P>> frames) {
            this.areasInMatrices = new RectangularArea[frames.size()];
            this.inverseTransforms = new CoordinateTransformationOperator[frames.size()];
            int n = 0;
            Point shiftMinus05 = null;
            for (Frame<P> frame : frames) {
                UniversalFramePosition p = frame.position();
                RectangularArea area = ShiftFramePosition.area(
                    Point.origin(frame.dimCount()), frame.matrix().dimensions());
                if (shiftMinus05 == null) {
View Full Code Here

    public RectangularArea area() {
        return area;
    }

    public Func asInterpolationFunc(Matrix<? extends PArray> sourceMatrix) {
        Point o = area.min();
        boolean integerShift = isShift && o.equals(o.toRoundedPoint().toPoint());
        Func f = Matrices.asInterpolationFunc(sourceMatrix,
            integerShift ?
                Matrices.InterpolationMethod.STEP_FUNCTION :
                Matrices.InterpolationMethod.POLYLINEAR_FUNCTION,
            Double.NaN);
View Full Code Here

TOP

Related Classes of net.algart.math.Point

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.