net.sf.latexdraw.glib.models.interfaces
Interface IPoint

All Known Implementing Classes:
LPoint

public interface IPoint

Defines an interface that classes defining a point should implement.

This file is part of LaTeXDraw.
Copyright (c) 2005-2012 Arnaud BLOUIN

LaTeXDraw 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 2 of the License, or (at your option) any later version.
LaTeXDraw is distributed 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.

07/02/2009

Since:
3.0
Version:
3.0
Author:
Arnaud BLOUIN

Method Summary
 IPoint centralSymmetry(IPoint pt)
          Gets a point by central symmetry.
 double computeAngle(IPoint pt)
          Computes the angle of the given point where the calling point is used as the gravity centre.
 double computeRotationAngle(IPoint pt1, IPoint pt2)
          Computes the angle of rotation between two points where the calling point is used as the gravity centre.
 double distance(double x, double y)
           
 double distance(IPoint pt)
           
 boolean equals(IPoint p, double gap)
          Allows to know if the point p is equal to the current point considering a gap.
 IPoint getMiddlePoint(IPoint p)
           
 double getX()
           
 double getY()
           
 IPoint horizontalSymmetry(IPoint origin)
          Returns horizontally the point.
 IPoint rotatePoint(IPoint gravityC, double theta)
          Rotates a point with as reference another point.
 void setPoint(double newX, double newY)
          Sets the coordinates of the point.
 void setPoint(IPoint pt)
          Changes the coordinates of the point.
 void setPoint2D(java.awt.geom.Point2D pt)
          Defines the current point using the given point.
 void setX(double newX)
          Sets the X coordinate of the point.
 void setY(double newY)
          Sets the Y coordinate of the point.
 java.awt.geom.Point2D.Double toPoint2D()
           
 void translate(double tx, double ty)
          Translates the point.
 IPoint verticalSymmetry(IPoint origin)
          Returns vertically the point.
 IPoint zoom(double zoomLevel)
          Creates a new point zoomed using the calling points.
 

Method Detail

getY

double getY()
Returns:
The Y coordinate of the point.
Since:
3.0

getX

double getX()
Returns:
The X coordinate of the point.
Since:
3.0

setPoint

void setPoint(IPoint pt)
Changes the coordinates of the point.

Parameters:
pt - The new position.
Since:
3.0

setX

void setX(double newX)
Sets the X coordinate of the point.

Parameters:
newX - The new X coordinate. Must be valid (not equal too NaN,...).
Since:
3.0

setY

void setY(double newY)
Sets the Y coordinate of the point.

Parameters:
newY - The new Y coordinate. Must be valid (not equal too NaN,...).
Since:
3.0

setPoint

void setPoint(double newX,
              double newY)
Sets the coordinates of the point.

Parameters:
newX - The new X coordinate. Must be valid (not equal too NaN,...).
newY - The new Y coordinate. Must be valid (not equal too NaN,...).
Since:
3.0

centralSymmetry

IPoint centralSymmetry(IPoint pt)
Gets a point by central symmetry.

Parameters:
pt - The centre of the symmetry.
Returns:
The resulting point.

horizontalSymmetry

IPoint horizontalSymmetry(IPoint origin)
Returns horizontally the point.

Parameters:
origin - The location of the horizontal axe.
Returns:
the computed point or null is the given point is not valid or if a problem occurs.

verticalSymmetry

IPoint verticalSymmetry(IPoint origin)
Returns vertically the point.

Parameters:
origin - The location of the vertical axe.
Returns:
the computed point or null is the given point is not valid or if a problem occurs.

computeAngle

double computeAngle(IPoint pt)
Computes the angle of the given point where the calling point is used as the gravity centre.

Parameters:
pt - The point used to compute the angle.
Returns:
The angle or NaN if the given point is not valid.

computeRotationAngle

double computeRotationAngle(IPoint pt1,
                            IPoint pt2)
Computes the angle of rotation between two points where the calling point is used as the gravity centre.

Parameters:
pt1 - The first point.
pt2 - The second point.
Returns:
The rotation point or NaN if one of the given point is not valid.

equals

boolean equals(IPoint p,
               double gap)
Allows to know if the point p is equal to the current point considering a gap.

Parameters:
p - The point to compare.
gap - The approximation gap.
Returns:
True if they are equals considering the gap.
Throws:
java.lang.IllegalArgumentException - When gap<0

getMiddlePoint

IPoint getMiddlePoint(IPoint p)
Parameters:
p - The second point.
Returns:
The middle point of the current and given points.

rotatePoint

IPoint rotatePoint(IPoint gravityC,
                   double theta)
Rotates a point with as reference another point.

Parameters:
gravityC - The point of reference.
theta - The angle of rotation in radian.
Returns:
The rotated point.
Since:
1.9

zoom

IPoint zoom(double zoomLevel)
Creates a new point zoomed using the calling points.

Parameters:
zoomLevel - The zoom level.
Returns:
The zoomed point.
Since:
3.0

translate

void translate(double tx,
               double ty)
Translates the point. If one of the given coordinate is not valid (NaN, infinite,...), then the translation does not occur.

Parameters:
tx - The X translation.
ty - The Y translation.

distance

double distance(IPoint pt)
Parameters:
pt - The second point.
Returns:
The distance between the two points.
Since:
3.0

distance

double distance(double x,
                double y)
Parameters:
x - The x coordinate of the second point.
y - The y coordinate of the second point.
Returns:
The distance between the two points.
Since:
3.0

toPoint2D

java.awt.geom.Point2D.Double toPoint2D()
Returns:
A Point2D.Double point equivalent to the current point.
Since:
3.0

setPoint2D

void setPoint2D(java.awt.geom.Point2D pt)
Defines the current point using the given point.

Parameters:
pt - The point 2D to copy.
Since:
3.0