Java Array Cross Product crossProduct(double x1, double y1, double x2, double y2, double x3, double y3)

Here you can find the source of crossProduct(double x1, double y1, double x2, double y2, double x3, double y3)

Description

Compute cross product : o(x2,y2) / cp > 0 / / cp < 0 / / o (x1, y1)

License

Open Source License

Parameter

Parameter Description
x1 seg first point x coord
y1 seg first point y coord
x2 seg second point x coord
y2 seg second point y coord
x3 the point to check x coord
y3 the point to check y coord

Declaration

static double crossProduct(double x1, double y1, double x2, double y2, double x3, double y3) 

Method Source Code

//package com.java2s;
/**//www.  j a  va  2  s  .c  o  m
 * OrbisGIS is a GIS application dedicated to scientific spatial simulation.
 * This cross-platform GIS is developed at French IRSTV institute and is able to
 * manipulate and create vector and raster spatial information.
 *
 * OrbisGIS is distributed under GPL 3 license. It is produced by the "Atelier SIG"
 * team of the IRSTV Institute <http://www.irstv.fr/> CNRS FR 2488.
 *
 * Copyright (C) 2007-2012 IRSTV (FR CNRS 2488)
 *
 * This file is part of OrbisGIS.
 *
 * OrbisGIS is free software: you can redistribute it and/or modify it under the
 * terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * OrbisGIS 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 Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * OrbisGIS. If not, see <http://www.gnu.org/licenses/>.
 *
 * For more information, please consult: <http://www.orbisgis.org/>
 * or contact directly:
 * info_at_ orbisgis.org
 */

public class Main {
    /**
     * Compute cross product :
     *
     *           o(x2,y2)
     *          /
     * cp > 0  /
     *        /    cp < 0
     *       /
     *      /
     *     o (x1, y1)
     *
     * @param x1 seg first point x coord
     * @param y1 seg first point y coord
     * @param x2 seg second point x coord
     * @param y2 seg second point y coord
     * @param x3 the point to check x coord
     * @param y3 the point to check y coord
     *
     */
    static double crossProduct(double x1, double y1, double x2, double y2, double x3, double y3) {
        return (x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1);
    }
}

Related

  1. cross3(double x1, double y1, double z1, double x2, double y2, double z2)
  2. cross33(float u[], float v[])
  3. crossEndForLineVectorAlgebra(double x1, double y1, double x2, double y2, double margin, double width)
  4. crossMuliply(double a, double b, double c)
  5. crossMult(int value, int maximum, int coefficient)
  6. crossProduct(double[] output, double[] a, double[] b)
  7. CrossProduct(final double[] vect1, final double[] vect2)
  8. crossProduct(int ax, int ay, int bx, int by, int cx, int cy)
  9. crossProduct(Object[] firstArray, Object[]... otherArrays)