Packageorg.un.flex.utils.geom
Interfacepublic interface IModel
ImplementorsBaseModel

A common interface to the geometric model typically used for Non-Euclidean layouts
The implementation is a rewrite of Jens Kanschik's Hypergraph implementation in Java. However, apart from the general idea and some variable names, this code improves on hypergraph and also implements additional functionality. Copyright (C) 2003 Jens Kanschik, mail : jensKanschik



Public Methods
 MethodDefined by
  
dist(z:IPoint):Number
Calculates the distance from z to the origin.
IModel
  
dist2(z:IPoint):Number
Computes the squared distance from z to the origin.
IModel
  
Computes the gradient at basePoint of the distance functions to z, i.e.
IModel
  
distanceGradientV(base:IPoint, z:IPoint, gradient:IVector):void
Computes the gradient at basePoint of the distance functions to z, i.e.
IModel
  
distP(z1:IPoint, z2:IPoint):Number
Computes the distance between two points.
IModel
  
distP2(z1:IPoint, z2:IPoint):Number
Computes the squared distance between two points.
IModel
  
exp(v:IVector, length:Number):IPoint
Calculates the exponent of the vector maintaining the same direction as the vector
IModel
  
getAngle(p:IPoint, z1:IPoint, z2:IPoint):Number
Returns the angle between the line segments starting at p and ending in z1 and z2 respectively.
If the model is orientated, the angle may have a sign, but this is not required.
IModel
  
Returns a "default" vector at the origin.
In most models, there is no special vector, but it is very convenient to have such a default vector to start with.
This vector is always located at the origin, is always normalized (i.e.
IModel
  
getDistance(p:IPoint, z1:IPoint, z2:IPoint, cutoff1:Boolean, cutoff2:Boolean):Number
Returns the distance of p to the line, ray or line segment from z1 to z2.
The parameters cutoff1 and cutoff2 define whether the whole line should be considered or only parts.
IModel
  
Returns the identity transformation.
IModel
  
Returns the origin of the model.
A model doesn't present a riemannian manifold, but the pair (M, p) of a riemannian manifold and a fixed point, the origin.
For a vector space, the origin is naturally 0.
IModel
  
getProjection(p:IPoint, z1:IPoint, z2:IPoint, cutoff1:Boolean, cutoff2:Boolean):IPoint
Returns the projection of point p on the line defined by the points z1 and z2.
IModel
  
getRotation(alpha:Number):IIsometry
Returns a rotation of alpha at the origin.
IModel
  
getRotationP(p:IPoint, alpha:Number):IIsometry
Returns a rotation of alpha at the point p.
IModel
  
Calculates the translation (isometry) to a given point p.
IModel
  
Calculates the translation (isometry) from a given point p2 to a destination point p1.
IModel
  
getTranslationIPPR(isom:IIsometry, p1:IPoint, p2:IPoint, r:Number):void
Calculate the translation of a given point to a destination point in a given number of steps
IModel
  
getTranslationIPR(isom:IIsometry, p:IPoint, r:Number):void
Calculates the r-th root (isometry) of the translation to a given point.
IModel
  
getTranslationIVR(isom:IIsometry, vector:IVector, r:Number):void
Calculates the translation for the base of the given vector in a specific direction
IModel
  
Returns the translation to a given point z.
IModel
  
Translate a point to another point
IModel
  
Translate a given point to a destination point in a given number of steps
IModel
  
Returns the r-th root (isometry) of the translation to a given point.
IModel
  
getTranslationVR(vector:IVector, r:Number):IIsometry
Returns the translation for the base of the given vector in a specific direction
IModel
  
length(v:IVector):Number
Returns the length of the vector.
IModel
  
length2(v:IVector):Number
Returns the squared length of the vector.
IModel
  
product(v1:IVector, v2:IVector):Number
Returns the scalar product of the two vectors.
They have to have the same base point, otherwise, a computation is not possible.
IModel
Method detail
dist()method
public function dist(z:IPoint):Number

Calculates the distance from z to the origin.

Parameters
z:IPoint — A point in the model.

Returns
Number — The distance from z to the origin.
dist2()method 
public function dist2(z:IPoint):Number

Computes the squared distance from z to the origin.

Parameters
z:IPoint — A point in the model.

Returns
Number — The squared distance from z to the origin.
distanceGradient()method 
public function distanceGradient(base:IPoint, z:IPoint):IVector

Computes the gradient at basePoint of the distance functions to z, i.e.

         grad           d(z)
             |basepoint
   
or "grad_{|basepoint}d(\cdot,z)" in tex.

Parameters
base:IPoint — The base of the gradient
 
z:IPoint — The end point of the gradient

Returns
IVector — the resulting gradient vector
distanceGradientV()method 
public function distanceGradientV(base:IPoint, z:IPoint, gradient:IVector):void

Computes the gradient at basePoint of the distance functions to z, i.e.

         grad           d(z)
             |basepoint
   
or "grad_{|basepoint}d(\cdot,z)" in tex.

Parameters
base:IPoint — The base of the gradient
 
z:IPoint — The end point of the gradient
 
gradient:IVector — the resulting gradient vector
distP()method 
public function distP(z1:IPoint, z2:IPoint):Number

Computes the distance between two points.

Parameters
z1:IPoint — A point in the model.
 
z2:IPoint — A point in the model.

Returns
Number — The distance of the two points.
distP2()method 
public function distP2(z1:IPoint, z2:IPoint):Number

Computes the squared distance between two points.

Parameters
z1:IPoint — A point in the model.
 
z2:IPoint — A point in the model.

Returns
Number — The squared distance of the two points.
exp()method 
public function exp(v:IVector, length:Number):IPoint

Calculates the exponent of the vector maintaining the same direction as the vector

Parameters
v:IVector — the vector to use
 
length:Number — the new length

Returns
IPoint — new vector length as a complex number
getAngle()method 
public function getAngle(p:IPoint, z1:IPoint, z2:IPoint):Number

Returns the angle between the line segments starting at p and ending in z1 and z2 respectively.
If the model is orientated, the angle may have a sign, but this is not required.

Parameters
p:IPoint — The commong starting point of the two segments.
 
z1:IPoint — The end point of the first line segment.
 
z2:IPoint — The end point of the first line segment.

Returns
Number — The angle of the hinge defined by the three parameters.
getDefaultVector()method 
public function getDefaultVector():IVector

Returns a "default" vector at the origin.
In most models, there is no special vector, but it is very convenient to have such a default vector to start with.
This vector is always located at the origin, is always normalized (i.e. has length 1) and it always has to be the same.

Returns
IVector — A normalized vector at the origin.
getDistance()method 
public function getDistance(p:IPoint, z1:IPoint, z2:IPoint, cutoff1:Boolean, cutoff2:Boolean):Number

Returns the distance of p to the line, ray or line segment from z1 to z2.
The parameters cutoff1 and cutoff2 define whether the whole line should be considered or only parts.

If the geometry of the model allows to give the distance a sign using a well defined orientation, (e.g. for most two dimensional models) it should do so, but it is not required.

Parameters
p:IPoint — The point from which the distance is computed.
 
z1:IPoint — The starting point of the line segment.
 
z2:IPoint — The end point of the line segment.
 
cutoff1:Boolean — If true, the line is cut off at z1.
 
cutoff2:Boolean — If true, the line is cut off at z2.

Returns
Number — The distance from p to the line, ray or linesegment defined by the other parameters.
getIdentity()method 
public function getIdentity():IIsometry

Returns the identity transformation.

Returns
IIsometry — The identity transformation.
getOrigin()method 
public function getOrigin():IPoint

Returns the origin of the model.
A model doesn't present a riemannian manifold, but the pair (M, p) of a riemannian manifold and a fixed point, the origin.
For a vector space, the origin is naturally 0.

Returns
IPoint — The origin of the model.
getProjection()method 
public function getProjection(p:IPoint, z1:IPoint, z2:IPoint, cutoff1:Boolean, cutoff2:Boolean):IPoint

Returns the projection of point p on the line defined by the points z1 and z2.

Parameters
p:IPoint — The point to project.
 
z1:IPoint — A point on the line on which to project.
 
z2:IPoint — A point on the line on which to project.
 
cutoff1:Boolean
 
cutoff2:Boolean

Returns
IPoint — The projection.
getRotation()method 
public function getRotation(alpha:Number):IIsometry

Returns a rotation of alpha at the origin. Only well defined in 2D, oriented models.

Parameters
alpha:Number — The angle of the rotation.

Returns
IIsometry — The rotation at the origin with angle alpha.
getRotationP()method 
public function getRotationP(p:IPoint, alpha:Number):IIsometry

Returns a rotation of alpha at the point p. Only well defined in 2D, oriented models.

Parameters
p:IPoint — The basepoint of the rotation.
 
alpha:Number — The angle of the rotation.

Returns
IIsometry — The rotation at p with angle alpha.
getTranslationIP()method 
public function getTranslationIP(isom:IIsometry, p:IPoint):void

Calculates the translation (isometry) to a given point p.

Parameters
isom:IIsometry — the resulting isometry
 
p:IPoint — the given point
getTranslationIPP()method 
public function getTranslationIPP(isom:IIsometry, p1:IPoint, p2:IPoint):void

Calculates the translation (isometry) from a given point p2 to a destination point p1.

Parameters
isom:IIsometry — the resulting isometry
 
p1:IPoint — the destination point
 
p2:IPoint — the given point
getTranslationIPPR()method 
public function getTranslationIPPR(isom:IIsometry, p1:IPoint, p2:IPoint, r:Number):void

Calculate the translation of a given point to a destination point in a given number of steps

Parameters
isom:IIsometry — the resulting isometry
 
p1:IPoint — The destination point
 
p2:IPoint — The given point
 
r:Number — Number of steps (roots)
getTranslationIPR()method 
public function getTranslationIPR(isom:IIsometry, p:IPoint, r:Number):void

Calculates the r-th root (isometry) of the translation to a given point.

Parameters
isom:IIsometry — the resulting isometry
 
p:IPoint — the given point
 
r:Number — the root.
getTranslationIVR()method 
public function getTranslationIVR(isom:IIsometry, vector:IVector, r:Number):void

Calculates the translation for the base of the given vector in a specific direction

Parameters
isom:IIsometry — the resulting isometry
 
vector:IVector — the vector to move
 
r:Number — distance to move
getTranslationP()method 
public function getTranslationP(z:IPoint):IIsometry

Returns the translation to a given point z.

Parameters
z:IPoint — the given point.

Returns
IIsometry
getTranslationPP()method 
public function getTranslationPP(z1:IPoint, z2:IPoint):IIsometry

Translate a point to another point

Parameters
z1:IPoint — The destination point
 
z2:IPoint — The point to be moved.

Returns
IIsometry
getTranslationPPR()method 
public function getTranslationPPR(z1:IPoint, z2:IPoint, r:Number):IIsometry

Translate a given point to a destination point in a given number of steps

Parameters
z1:IPoint — The destination point
 
z2:IPoint — The given point
 
r:Number — Number of steps (roots)

Returns
IIsometry
getTranslationPR()method 
public function getTranslationPR(z:IPoint, r:Number):IIsometry

Returns the r-th root (isometry) of the translation to a given point.

Parameters
z:IPoint — the given point.
 
r:Number — the root.

Returns
IIsometry
getTranslationVR()method 
public function getTranslationVR(vector:IVector, r:Number):IIsometry

Returns the translation for the base of the given vector in a specific direction

Parameters
vector:IVector — the vector to move
 
r:Number — distance to move

Returns
IIsometry
length()method 
public function length(v:IVector):Number

Returns the length of the vector.

Parameters
v:IVector — A vector in the tangent space of the model.

Returns
Number — The length of the vector.
length2()method 
public function length2(v:IVector):Number

Returns the squared length of the vector.

Parameters
v:IVector — A vector in the tangent space of the model.

Returns
Number — The squared length of the vector.
product()method 
public function product(v1:IVector, v2:IVector):Number

Returns the scalar product of the two vectors.
They have to have the same base point, otherwise, a computation is not possible. NaN is returned in this situation.

Parameters
v1:IVector — A vector in the tangentspace of the model.
 
v2:IVector — A vector in the tangentspace of the model.

Returns
Number — The scalar product of both vectors.