org.vectomatic.dom.svg
Class OMSVGPoint

java.lang.Object
  extended by com.google.gwt.core.client.JavaScriptObject
      extended by org.vectomatic.dom.svg.OMSVGPoint

public class OMSVGPoint
extends com.google.gwt.core.client.JavaScriptObject

Many of the SVG DOM interfaces refer to objects of class OMSVGPoint. An OMSVGPoint is an (x, y) coordinate pair. When used in matrix operations, an OMSVGPoint is treated as a vector of the form:

 [x]
 [y]
 [1]

If an OMSVGRect object is designated as read only, then attempting to assign to one of its attributes will result in an exception being thrown.


Constructor Summary
protected OMSVGPoint()
           
 
Method Summary
 OMSVGPoint add(OMSVGPoint p)
          Adds the specified point to this point.
 OMSVGPoint add(OMSVGPoint p, OMSVGPoint destination)
          Adds the specified point to this point and puts the result in the specified destination point.
 OMSVGPoint assignTo(OMSVGPoint destination)
          Copies this point to the specified destination point.
 float crossProduct(OMSVGPoint p)
          Returns the cross product of this point and the specified point.
 float distance(OMSVGPoint p)
          Returns the euclidian distance from this point to specified point.
 float distance2(OMSVGPoint p)
          Returns the squared euclidian distance from this point to specified point.
 float dotProduct(OMSVGPoint p)
          Returns the dot product of this point and the specified point.
 OMSVGPoint floor()
          Applies the Math.floor() to the coordinated of this point.
 OMSVGPoint floor(OMSVGPoint destination)
          Applies the Math.floor() to the coordinated of this point and puts the result in the specified destination point.
 String getDescription()
          Returns a textual description of the point for debugging purposes.
 float getX()
          The x coordinate.
 float getY()
          The y coordinate.
 float length()
          Returns the length of this point, treating the point as a 2D vector.
 float length2()
          Returns the squared length of this point, treating the point as a 2D vector.
 OMSVGPoint matrixTransform(OMSVGMatrix matrix)
          Applies a 2x3 matrix transformation on this OMSVGPoint object and returns a new, transformed OMSVGPoint object:
 OMSVGPoint product(OMSVGPoint p)
          Multiplies this point by the specified point.
 OMSVGPoint product(OMSVGPoint p, OMSVGPoint destination)
          Multiplies this point by the specified point and puts the result in the specified destination point.
 OMSVGPoint round()
          Applies the Math.round() to the coordinated of this point.
 OMSVGPoint round(OMSVGPoint destination)
          Applies the Math.round() to the coordinated of this point and puts the result in the specified destination point.
 OMSVGPoint scale(float f)
          Scales this point by the specified factor.
 OMSVGPoint scale(float f, OMSVGPoint destination)
          Scales this point by the specified factor and puts the result in the specified destination point.
 void setX(float value)
          The x coordinate.
 void setY(float value)
          The y coordinate.
 OMSVGPoint substract(OMSVGPoint p)
          Substracts the specified point from this point.
 OMSVGPoint substract(OMSVGPoint p, OMSVGPoint destination)
          Substracts the specified point to this point and puts the result in the specified destination point.
 
Methods inherited from class com.google.gwt.core.client.JavaScriptObject
cast, createArray, createFunction, createObject, equals, hashCode, toSource, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OMSVGPoint

protected OMSVGPoint()
Method Detail

getX

public final float getX()
The x coordinate.


setX

public final void setX(float value)
                throws com.google.gwt.core.client.JavaScriptException
The x coordinate.

Throws:
DOMException(NO_MODIFICATION_ALLOWED_ERR) - Raised if the OMSVGPoint object is read only, or corresponds to a DOM attribute that is read only.
com.google.gwt.core.client.JavaScriptException

getY

public final float getY()
The y coordinate.


setY

public final void setY(float value)
                throws com.google.gwt.core.client.JavaScriptException
The y coordinate.

Throws:
DOMException(NO_MODIFICATION_ALLOWED_ERR) - Raised if the OMSVGPoint object is read only, or corresponds to a DOM attribute that is read only.
com.google.gwt.core.client.JavaScriptException

matrixTransform

public final OMSVGPoint matrixTransform(OMSVGMatrix matrix)

Applies a 2x3 matrix transformation on this OMSVGPoint object and returns a new, transformed OMSVGPoint object:

newpoint = matrix thispoint

Parameters:
matrix - The matrix which is to be applied to this OMSVGPoint object.
Returns:
A new OMSVGPoint object.

getDescription

public final String getDescription()
Returns a textual description of the point for debugging purposes.

Returns:
a textual description of the point.

add

public final OMSVGPoint add(OMSVGPoint p)
Adds the specified point to this point. The points are treated by this method as 2D vectors.

Parameters:
p - the point to add.
Returns:
this point.

add

public final OMSVGPoint add(OMSVGPoint p,
                            OMSVGPoint destination)
Adds the specified point to this point and puts the result in the specified destination point. The points are treated by this method as 2D vectors.

Parameters:
p - the point to add.
destination - the destination point.
Returns:
the destination point.

substract

public final OMSVGPoint substract(OMSVGPoint p)
Substracts the specified point from this point. The points are treated by this method as 2D vectors.

Parameters:
p - the point to substract.
Returns:
this point.

substract

public final OMSVGPoint substract(OMSVGPoint p,
                                  OMSVGPoint destination)
Substracts the specified point to this point and puts the result in the specified destination point. The points are treated by this method as 2D vectors.

Parameters:
p - the point to substract.
destination - the destination point.
Returns:
the destination point.

scale

public final OMSVGPoint scale(float f)
Scales this point by the specified factor. The point is treated by this method as a 2D vector.

Parameters:
f - scale factor.
Returns:
this point.

scale

public final OMSVGPoint scale(float f,
                              OMSVGPoint destination)
Scales this point by the specified factor and puts the result in the specified destination point. The points are treated by this method as 2D vectors.

Parameters:
f - scale factor.
destination - the destination point.
Returns:
the destination point.

assignTo

public final OMSVGPoint assignTo(OMSVGPoint destination)
Copies this point to the specified destination point.

Parameters:
destination - the destination point.
Returns:
the destination point.

product

public final OMSVGPoint product(OMSVGPoint p)
Multiplies this point by the specified point. The points are treated by this method as 2D vectors.

Parameters:
p - the point to multiply by.
Returns:
this point.

product

public final OMSVGPoint product(OMSVGPoint p,
                                OMSVGPoint destination)
Multiplies this point by the specified point and puts the result in the specified destination point. The points are treated by this method as 2D vectors.

Parameters:
p - the point to multiply by.
destination - the destination point.
Returns:
the destination point.

dotProduct

public final float dotProduct(OMSVGPoint p)
Returns the dot product of this point and the specified point. The points are treated by this method as 2D vectors.

Parameters:
p - the second factor of the dot product.
Returns:
the dot product of this point and the specified point

crossProduct

public final float crossProduct(OMSVGPoint p)
Returns the cross product of this point and the specified point. The points are treated by this method as 2D vectors.

Parameters:
p - the second factor of the cross product.
Returns:
the cross product of this point and the specified point

round

public final OMSVGPoint round()
Applies the Math.round() to the coordinated of this point.

Returns:
this point.

round

public final OMSVGPoint round(OMSVGPoint destination)
Applies the Math.round() to the coordinated of this point and puts the result in the specified destination point.

Parameters:
destination - the destination point.
Returns:
the destination point.

floor

public final OMSVGPoint floor()
Applies the Math.floor() to the coordinated of this point.

Returns:
this point.

floor

public final OMSVGPoint floor(OMSVGPoint destination)
Applies the Math.floor() to the coordinated of this point and puts the result in the specified destination point.

Parameters:
destination - the destination point.
Returns:
the destination point.

length

public final float length()
Returns the length of this point, treating the point as a 2D vector.

Returns:
the length of this point

length2

public final float length2()
Returns the squared length of this point, treating the point as a 2D vector.

Returns:
the squared length of this point

distance

public final float distance(OMSVGPoint p)
Returns the euclidian distance from this point to specified point.

Parameters:
p - the point used to measure the distance
Returns:
the euclidian distance from this point to specified point

distance2

public final float distance2(OMSVGPoint p)
Returns the squared euclidian distance from this point to specified point.

Parameters:
p - the point used to measure the distance
Returns:
the squared euclidian distance from this point to specified point


Copyright © 2012. All Rights Reserved.