All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jeometry.geom2D.point.Coord2D Maven / Gradle / Ivy

There is a newer version: 1.0.5
Show newest version
package org.jeometry.geom2D.point;

import org.jeometry.Jeometry;
import org.jeometry.math.Vector;

/**
 * A coordinates within a 2D space.
 * @author Julien Seinturier - COMEX S.A. - [email protected] - https://github.com/jorigin/jeometry
 * @version {@value Jeometry#version}
 * @since 1.0.0
 */
public interface Coord2D extends Vector{
	/**
	 * The index of the dimension of the X coordinates.
	 * @see #DIMENSION_Y
	 */
	public static final int DIMENSION_X = 0;

	/**
	 * The index of the dimension of the Y coordinates.
	 * @see #DIMENSION_X
	 */
	public static final int DIMENSION_Y = 1; 

	/**
	 * Get the point coordinate along the X axis.
	 * @return the point coordinate along the X axis.
	 * @see #getY()
	 * @see #setX(double)
	 */
	public double getX();

	/**
	 * Set the point coordinate along the X axis.
	 * @param x the point coordinate along the X axis.
	 * @see #setY(double)
	 * @see #getX()
	 */
	public void setX(double x);


	/**
	 * Get the point coordinate along the Y axis.
	 * @return the point coordinate along the Y axis.
	 * @see #getX()
	 * @see #setY(double)
	 */
	public double getY();

	/**
	 * Set the point coordinate along the Y axis.
	 * @param y the point coordinate along the Y axis.
	 * @see #setX(double)
	 * @see #getY()
	 */
	public void setY(double y);

	@Override
	public Coord2D plus(Vector v);

	@Override
	public Coord2D plusAffect(Vector v);

	@Override
	public Coord2D plus(double scalar);
	
	@Override
	public Coord2D plusAffect(double scalar);
	
	@Override
	public Coord2D minus(Vector v);

	@Override
	public Coord2D minusAffect(Vector v);

	@Override
	public Coord2D minus(double scalar);
	
	@Override
	public Coord2D minusAffect(double scalar);
	
	@Override
	public Coord2D multiply(double scalar);

	@Override
	public Coord2D multiplyAffect(double scalar);

	@Override
	public Coord2D multiply(Vector v);

	@Override
	public Coord2D multiplyAffect(Vector v);
	
	@Override
	public Coord2D divide(Vector v);

	@Override
	public Coord2D divideAffect(Vector v);
	
	@Override
	public Coord2D divide(double scalar);

	@Override
	public Coord2D divideAffect(double scalar);
	
	/**
	 * Compute the Eucliean norm of the vector represented by these coordinates. 
	 * Let a = (xa, ya) be a 2D vector, the Euclidean norm of a, denoted ||a|| is such that:
* $$||a||\ =\ \sqrt{x_{a}^{2}\ +\ y_{a}^{2}}$$ * @return the Euclidean norm of the vector represented by these coordinates. * @see #normSquare() */ @Override public double norm(); /** * Compute the squared Eucliean norm of the vector represented by these coordinates. * Let a = (xa, ya) be a 2D vector, the Euclidean norm of a, denoted ||a|| is such that:
* $$||a||^{2}\ =\ x_{a}^{2}\ +\ y_{a}^{2}$$ * @return the squared Euclidean norm of the vector represented by these coordinates. */ @Override public double normSquare(); /** * Divide all these coordinates by their {@link #norm() Euclidean norm}. When called on coordinates c = (x, y), this method modify them as follows:
* $$v\ =\ (\frac{x}{||p||},\ \frac{y}{||p||})$$ * @see #norm() */ @Override public void normalize(); /** * Return normalized coordinates that are orthogonal to these ones. * @return a normalized coordinates that are orthogonal to these ones. * @see #orthogonal(Vector) */ @Override public Coord2D orthogonal(); /** * Set the given result coordinates with the normalized normalized coordinates that are orthogonal to these ones. * @param result the coordinates where the result has to be stored. * @return the given result coordinates with the normalized normalized coordinates that are orthogonal to these ones. * @see #orthogonal() * @throws IllegalArgumentException if the result vector length is less than 2. */ @Override public Coord2D orthogonal(Vector result); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy