Java Geometry Algorithm coordinateSplit(Point2D.Double[] aPoints, double[] aX, double[] aY)

Here you can find the source of coordinateSplit(Point2D.Double[] aPoints, double[] aX, double[] aY)

Description

Stores the coordinates of the given points in separate arrays.

License

Open Source License

Parameter

Parameter Description
aPoints Array of points from which coordinate values are to be read.
aX Array to store the values of the <i>x</i> coordinates of the points. The length of this array must be at least the length of <code>aPoints</code>.
aY Array to store the values of the <i>y</i> coordinates of the points. The length of this array must be at least the length of <code>aPoints</code>.

Exception

Parameter Description
ArrayIndexOutOfBoundsException If the length of <code>aX</code> or of<code>aY</code> is smaller than the length of <code>aPoints</code>.
NullPointerException If any of the parameters is <code>null</code>.

Declaration

public static void coordinateSplit(Point2D.Double[] aPoints, double[] aX, double[] aY) 

Method Source Code


//package com.java2s;
/*/*  w  ww  .j a  v  a  2s.c o  m*/
 * #%L
 * Cytoscape NetworkAnalyzer Impl (network-analyzer-impl)
 * $Id:$
 * $HeadURL:$
 * %%
 * Copyright (C) 2006 - 2013
 *   Max Planck Institute for Informatics, Saarbruecken, Germany
 *   The Cytoscape Consortium
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as 
 * published by the Free Software Foundation, either version 2.1 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Lesser Public License for more details.
 * 
 * You should have received a copy of the GNU General Lesser Public 
 * License along with this program.  If not, see
 * <http://www.gnu.org/licenses/lgpl-2.1.html>.
 * #L%
 */

import java.awt.geom.Point2D;

public class Main {
    /**
     * Stores the coordinates of the given points in separate arrays.
     * 
     * @param aPoints Array of points from which coordinate values are to be read.
     * @param aX Array to store the values of the <i>x</i> coordinates of the points. The length of
     *        this array must be at least the length of <code>aPoints</code>.
     * @param aY Array to store the values of the <i>y</i> coordinates of the points. The length of
     *        this array must be at least the length of <code>aPoints</code>.
     * 
     * @throws ArrayIndexOutOfBoundsException If the length of <code>aX</code> or of
     *         <code>aY</code> is smaller than the length of <code>aPoints</code>.
     * @throws NullPointerException If any of the parameters is <code>null</code>.
     */
    public static void coordinateSplit(Point2D.Double[] aPoints, double[] aX, double[] aY) {
        final int count = aPoints.length;
        if (aX.length < count || aY.length < count) {
            throw new ArrayIndexOutOfBoundsException(count);
        }
        for (int i = 0; i < count; ++i) {
            final Point2D.Double point = aPoints[i];
            aX[i] = point.x;
            aY[i] = point.y;
        }
    }
}

Related

  1. computeAngleDEG(@Nonnull Point2D p1, @Nonnull Point2D p2)
  2. computeAngleRAD(@Nonnull Point2D p)
  3. computeBarycenter(Map values)
  4. computeEuclideanDistance(Point2D point1, Point2D point2)
  5. computePolygonArea(Point2D[] pts)
  6. cornersToWorldFile(Point2D[] esq, Dimension size)
  7. curvedLineHit(Point point, Point startPoint, Point endPoint, Point controlPoint1, Point controlPoint2, float padding)
  8. derivativeOfCubicBezier(Point2D p0, Point2D p1, Point2D p2, Point2D p3, double t)
  9. deriveLocation(Point origin, double radius)