igeo
Class IVec2

java.lang.Object
  extended by igeo.IParameterObject
      extended by igeo.IVec2
All Implemented Interfaces:
IArithmeticVal<IVec2I,IDoubleI>, IEntityParameter, IParameter, ISubobject, IVal, IVec2I, IVec2Op

public class IVec2
extends IParameterObject
implements IVec2I, IEntityParameter

Class of 2 dimensional vector.

Author:
Satoru Sugihara

Field Summary
 double x
           
static IVec2 xaxis
           
 double y
           
static IVec2 yaxis
           
 
Fields inherited from class igeo.IParameterObject
parent
 
Constructor Summary
IVec2()
           
IVec2(double x, double y)
           
IVec2(IDoubleI x, IDoubleI y)
           
IVec2(IServerI s)
           
IVec2(IServerI s, double x, double y)
           
IVec2(IServerI s, IDoubleI x, IDoubleI y)
           
IVec2(IServerI s, IVec2 v)
           
IVec2(IServerI s, IVec2I v)
           
IVec2(IServerI s, IVecI v)
           
IVec2(IServerI s, IVecI v, IVecI projectionDir)
           
IVec2(IServerI s, IVecI v, IVecI xaxis, IVecI yaxis)
           
IVec2(IServerI s, IVecI v, IVecI xaxis, IVecI yaxis, IVecI origin)
           
IVec2(IVec2 v)
           
IVec2(IVec2I v)
           
IVec2(IVecI v)
           
IVec2(IVecI v, IVecI projectionDir)
           
IVec2(IVecI v, IVecI xaxis, IVecI yaxis)
           
IVec2(IVecI v, IVecI xaxis, IVecI yaxis, IVecI origin)
           
 
Method Summary
 IVec2 add(double x, double y)
           
 IVec2 add(double f, IVec2 v)
          scale add; alias
 IVec2 add(double f, IVec2I v)
          scale add; alias
 IVec2 add(IDoubleI x, IDoubleI y)
           
 IVec2 add(IDoubleI f, IVec2I v)
          scale add; alias
 IVec2 add(IVec2 v)
           
 IVec2 add(IVec2 v, double f)
          scale add
 IVec2 add(IVec2I v)
           
 IVec2 add(IVec2I v, double f)
          scale add
 IVec2 add(IVec2I v, IDoubleI f)
          scale add
 double angle(double vx, double vy)
          angle between two vectors
 double angle(ISwitchE e, IVec2I v)
          angle between two vectors
 IDouble angle(ISwitchR r, IVec2I v)
          angle between two vectors
 double angle(IVec2 v)
           
 double angle(IVec2I v)
          angle between two vectors
 IVec2 bisect(double vx, double vy)
          create a new instance of bisector
 IVec2 bisect(IVec2 v)
          create a new instance of bisector
 IVec2 bisect(IVec2I v)
          create a new instance of bisector
 IVec2 cp()
          cp() is alias of dup()
 IVec2 cp(double x, double y)
          cp() is alias of dup().add()
 IVec2 cp(IDoubleI x, IDoubleI y)
          cp() is alias of dup().add()
 IVec2 cp(IVec2 v)
          cp() is alias of dup().add()
 IVec2 cp(IVec2I v)
          cp() is alias of dup().add()
 IVec cross(double vx, double vy)
          cross product in z direction as IVec
 IVec cross(IVec2 v)
          cross product in z direction as IVec
 IVec cross(IVec2I v)
          cross product in z direction as IVec
 IVec2 dif(double vx, double vy)
          create a new instance of difference
 IVec2 dif(IVec2 v)
          create a new instance of difference
 IVec2 dif(IVec2I v)
          create a new instance of difference
 IVec2 diff(double vx, double vy)
          alias of dif
 IVec2 diff(IVec2 v)
          alias of dif
 IVec2 diff(IVec2I v)
          alias of dif
 double dist(double vx, double vy)
          distance of two vectors
 double dist(ISwitchE e, IVec2I v)
          distance of two vectors
 IDouble dist(ISwitchR r, IVec2I v)
          distance of two vectors
 double dist(IVec2 v)
          distance of two vectors
 double dist(IVec2I v)
          distance of two vectors
 double dist2(double vx, double vy)
          squared distance of two vectors
 double dist2(ISwitchE e, IVec2I v)
          squared distance of two vectors
 IDouble dist2(ISwitchR r, IVec2I v)
          squared distance of two vectors
 double dist2(IVec2 v)
          squared distance of two vectors
 double dist2(IVec2I v)
          squared distance of two vectors
 double distToLine(IVec2I lineDir)
          distance to a line dir
 double distToLine(IVec2I lineDir, IVec2I linePt)
          distance to an infinite line
 double distToLine(IVec2 pt1, IVec2 pt2)
          distance to an infinite line issue: there is another distToLine(IVecI lineDir,IVecI linePt) method
 double distToSegment(IVec2I linePt1, IVec2I linePt2)
          distance to a line segment
 double distToTriangle(IVec2I pt1, IVec2I pt2, IVec2I pt3)
          distance to a triangle
 IVec2 div(double x)
           
 IVec2 div(IDouble v)
           
 IVec2 div(IDoubleI v)
           
 double dot(double vx, double vy)
          dot product
 double dot(ISwitchE e, IVec2I v)
          dot product
 IDouble dot(ISwitchR r, IVec2I v)
          dot product
 double dot(IVec2 v)
          dot product
 double dot(IVec2I v)
          dot product
 IVec2 dup()
           
 boolean eq(double vx, double vy)
          whether location is same or not
 boolean eq(double vx, double vy, double tolerance)
          whether location is same or not within tolerance
 boolean eq(ISwitchE e, IVec2I v)
          whether location is same or not
 boolean eq(ISwitchE e, IVec2I v, double tolerance)
          whether location is same or not within tolerance
 IBool eq(ISwitchR r, IVec2I v)
          whether location is same or not
 IBool eq(ISwitchR r, IVec2I v, IDoubleI tolerance)
          whether location is same or not within tolerance
 boolean eq(IVec2 v)
          whether location is same or not
 boolean eq(IVec2 v, double tolerance)
          whether location is same or not within tolerance
 boolean eq(IVec2I v)
          whether location is same or not
 boolean eq(IVec2I v, double tolerance)
          whether location is same or not within tolerance
 boolean eqX(double vx)
          check if same in X
 boolean eqX(double vx, double tolerance)
          check if same in X within tolerance
 boolean eqX(ISwitchE e, IVec2I v)
          check if same in X
 boolean eqX(ISwitchE e, IVec2I v, double tolerance)
          check if same in X within tolerance
 IBool eqX(ISwitchR r, IVec2I v)
          check if same in X
 IBool eqX(ISwitchR r, IVec2I v, IDoubleI tolerance)
          check if same in X within tolerance
 boolean eqX(IVec2 v)
          check if same in X
 boolean eqX(IVec2 v, double tolerance)
          check if same in X within tolerance
 boolean eqX(IVec2I v)
          check if same in X
 boolean eqX(IVec2I v, double tolerance)
          check if same in X within tolerance
 boolean eqY(double vy)
          check if same in Y
 boolean eqY(double vy, double tolerance)
          check if same in Y within tolerance
 boolean eqY(ISwitchE e, IVec2I v)
          check if same in Y
 boolean eqY(ISwitchE e, IVec2I v, double tolerance)
          check if same in Y within tolerance
 IBool eqY(ISwitchR r, IVec2I v)
          check if same in Y
 IBool eqY(ISwitchR r, IVec2I v, IDoubleI tolerance)
          check if same in Y within tolerance
 boolean eqY(IVec2 v)
          check if same in Y
 boolean eqY(IVec2 v, double tolerance)
          check if same in Y within tolerance
 boolean eqY(IVec2I v)
          check if same in Y
 boolean eqY(IVec2I v, double tolerance)
          check if same in Y within tolerance
 IVec2 flip()
          alias of neg
 IVec2 get()
           
 IDouble getX()
           
 IDouble getY()
           
static IVec2 intersect(IVec2I pt1, IVec2I dir1, IVec2I pt2, IVec2I dir2)
          intersection of two infinite lines
static IVec2[] intersectLineAndCircle(IVec2I linePt, IVec2I lineDir, IVec2I circleCenter, double radius)
          intersection of an infinite line and a circle
static IVec2 intersectPolygon(IVec2I p1, IVec2I p2, IVec2I[] pts)
           
static IVec2 intersectPolyline(IVec2I p1, IVec2I p2, IVec2I[] pts)
           
static IVec2 intersectPolyline(IVec2I p1, IVec2I p2, IVec2I[] pts, boolean closed)
           
static IVec2 intersectSegment(IVec2I line1pt1, IVec2I line1pt2, IVec2I line2pt1, IVec2I line2pt2)
           
static IVec2 intersectSegmentAndXLine(IVec2I linePt1, IVec2I linePt2, double y)
           
static IVec2 intersectSegmentAndYLine(IVec2I linePt1, IVec2I linePt2, double x)
           
static IVec2 intersectXLine(IVec2 linePt, IVec2 lineDir, double yOfXLine)
           
static IVec2 intersectYLine(IVec2 linePt, IVec2 lineDir, double xOfYLine)
           
 boolean isBetween(IVec2I pt1, IVec2I pt2)
           
 boolean isInside(IVec2[] pts)
          determine if the point is insde the polygon defined by the argument true if the point is on the edge of polygon
 boolean isInside(IVec2I[] pts)
          determine if the point is insde the polygon defined by the argument
 boolean isOnLine(IVec2 pt1, IVec2 pt2)
           
 boolean isParallel(IVec2I v)
          check if two vectors are parallel
 boolean isParallel(IVec2I v, double angleReso)
          check if two vectors are parallel
 boolean isStraight(IVec2I v1, IVec2I v2)
          check if three locations are on straight line
 boolean isStraight(IVec2I v1, IVec2I v2, double angleReso)
          check if three locations are on straight line
 boolean isValid()
          checking x, y is valid number (not Infinite, nor NaN).
 double len()
          getting length
 IVec2 len(double l)
          setting length
 IVec2 len(IDoubleI l)
          setting length
 double len(ISwitchE e)
          getting length
 IDouble len(ISwitchR r)
          getting length
 double len2()
          return squared length of the vector in double
 double len2(ISwitchE e)
          return squared length of the vector in double
 IDouble len2(ISwitchR r)
          return squared length of the vector in double
 IVec2 mid(double vx, double vy)
          create a new instance of midpoint
 IVec2 mid(IVec2 v)
          create a new instance of midpoint
 IVec2 mid(IVec2I v)
          create a new instance of midpoint
 IVec2 mirror(double lineX, double lineY)
          reflect (mirror) 2 dimensionally to the other side of the line
 IVec2 mirror(double linePtX, double linePtY, double lineDirX, double lineDirY)
          reflect (mirror) 2 dimensionally to the other side of the line at line point
 IVec2 mirror(IVec2 lineDir)
          reflect (mirror) 2 dimensionally to the other side of the line
 IVec2 mirror(IVec2I lineDir)
          reflect (mirror) 2 dimensionally to the other side of the line
 IVec2 mirror(IVec2I linePt, IVec2I lineDir)
          reflect (mirror) 2 dimensionally to the other side of the line
 IVec2 mirror(IVec2 linePt, IVec2 lineDir)
          reflect (mirror) 2 dimensionally to the other side of the line
 IVec2 mul(double x)
           
 IVec2 mul(IDouble v)
           
 IVec2 mul(IDoubleI v)
           
 IVec2 mv(double x, double y)
          mv() is alias of add()
 IVec2 mv(IDoubleI x, IDoubleI y)
          mv() is alias of add()
 IVec2 mv(IVec2 v)
          mv() is alias of add()
 IVec2 mv(IVec2I v)
          mv() is alias of add()
 IVec2 neg()
           
 IVecI nml(double vx, double vy)
          alias of cross
 IVecI nml(double vx1, double vy1, double vx2, double vy2)
          create normal vector from 3 points of self, pt1 and pt2
 IVec nml(IVec2 v)
          alias of cross
 IVec nml(IVec2I v)
          alias of cross
 IVecI nml(IVec2I pt1, IVec2I pt2)
          create normal vector from 3 points of self, pt1 and pt2
 IVecI nml(IVec2 pt1, IVec2 pt2)
          create normal vector from 3 points of self, pt1 and pt2
 IVec2 ortho()
          rotate vector in Pi/2
 IVec2 perpendicularVecToLine(IVec2I lineDir)
          create a new vector from line to this point perpendicular to the line dir
 IVec2 perpendicularVecToLine(IVec2I lineDir, IVec2I linePt)
          create a new vector from this point to the line in parpendicular direction.
 double[] projectTo2Vec(IVec2I v1, IVec2I v2)
          project the vector to the plane defined by two input vector and decompose vector to two vector and another perpendicular vector and returns coefficient of them.
 double ratioOnSegment(IVec2I linePt1, IVec2I linePt2)
          ratio of projected point between two points (line segment).
 IVec2 ref(double lineX, double lineY)
          reflect (mirror) 2 dimensionally to the other side of the line
 IVec2 ref(double linePtX, double linePtY, double lineDirX, double lineDirY)
          reflect (mirror) 2 dimensionally to the other side of the line at line point
 IVec2 ref(IVec2 lineDir)
          reflect (mirror) 2 dimensionally to the other side of the line
 IVec2 ref(IVec2I lineDir)
          reflect (mirror) 2 dimensionally to the other side of the line
 IVec2 ref(IVec2I linePt, IVec2I lineDir)
          reflect (mirror) 2 dimensionally to the other side of the line
 IVec2 ref(IVec2 linePt, IVec2 lineDir)
          reflect (mirror) 2 dimensionally to the other side of the line
static IVec2I[] removeDuplicatedPoints(IVec2I[] pts, boolean closed)
           
static IVec2I[] removeStraightPoints(IVec2I[] pts, boolean closed)
          remove points which are on straight line of adjacents
 IVec2 rev()
          alias of neg
 IVec2 rot(double angle)
          rotate
 IVec2 rot(double centerX, double centerY, double angle)
          rotate around center
 IVec2 rot(IDoubleI angle)
          rotate
 IVec2 rot(IVec2 destDir)
          rotate towards destination direction
 IVec2 rot(IVec2 center, double angle)
          rotate around center
 IVec2 rot(IVec2I destDir)
          rotate towards destination direction
 IVec2 rot(IVec2I center, double angle)
          rotate around center
 IVec2 rot(IVec2I center, IDoubleI angle)
          rotate around center
 IVec2 rot(IVec2I center, IVec2I destPt)
          rotate around center towards destination point
 IVec2 rot(IVec2 center, IVec2 destPt)
          rotate around center towards destination point
 IVec2 scale(double f)
          alias of mul
 IVec2 scale(double centerX, double centerY, double f)
          scale around center
 IVec2 scale(IDoubleI f)
          alias of mul
 IVec2 scale(IVec2 center, double f)
          scale around center
 IVec2 scale(IVec2I center, double f)
          scale around center
 IVec2 scale(IVec2I center, IDoubleI f)
          scale around center
 IVec2 scale1d(double axisX, double axisY, double f)
          scale only in 1 direction
 IVec2 scale1d(double centerX, double centerY, double axisX, double axisY, double f)
          scale only in 1 direction from a center
 IVec2 scale1d(IVec2 axis, double f)
          scale only in 1 direction
 IVec2 scale1d(IVec2I axis, double f)
          scale only in 1 direction
 IVec2 scale1d(IVec2I axis, IDoubleI f)
          scale only in 1 direction
 IVec2 scale1d(IVec2I center, IVec2I axis, double f)
          scale only in 1 direction from a center
 IVec2 scale1d(IVec2I center, IVec2I axis, IDoubleI f)
          scale only in 1 direction from a center
 IVec2 scale1d(IVec2 center, IVec2 axis, double f)
          scale only in 1 direction from a center
 IVec2 set(double x, double y)
           
 IVec2 set(IDoubleI x, IDoubleI y)
           
 IVec2 set(IVec2 v)
           
 IVec2 set(IVec2I v)
           
 IVec2 set(IVecI v)
           
 IVec2 set(IVecI v, IVecI projectionDir)
           
 IVec2 set(IVecI v, IVecI xaxis, IVecI yaxis)
           
 IVec2 set(IVecI v, IVecI xaxis, IVecI yaxis, IVecI origin)
           
 IVec2 shear(double sxy, double syx)
          shear operation on XY
 IVec2 shear(IDoubleI sxy, IDoubleI syx)
          shear operation on XY
 IVec2 shear(IVec2I center, double sxy, double syx)
          shear operation on XY
 IVec2 shear(IVec2I center, IDoubleI sxy, IDoubleI syx)
          shear operation on XY
 IVec2 sub(double x, double y)
           
 IVec2 sub(IDoubleI x, IDoubleI y)
           
 IVec2 sub(IVec2 v)
           
 IVec2 sub(IVec2I v)
           
 IVec2 sum(double vx, double vy)
          create a new instance of summation
 IVec2 sum(IVec2 v)
          create a new instance of summation
 IVec2 sum(IVec2 v2, double w2)
          create a new instance of weighted sum
 IVec2 sum(IVec2 v2, double w1, double w2)
          create a new instance of weighted sum
 IVec2 sum(IVec2I... v)
          create a new instance of summation
 IVec2 sum(IVec2I v)
          create a new instance of summation
 IVec2 sum(IVec2I v2, double w2)
          create a new instance of weighted sum
 IVec2 sum(IVec2I v2, double w1, double w2)
          create a new instance of weighted sum
 IVec2 sum(IVec2I v2, IDoubleI w2)
          create a new instance of weighted sum
 IVec2 sum(IVec2I v2, IDoubleI w1, IDoubleI w2)
          create a new instance of weighted sum
 IVec to3d()
           
 IVec to3d(double z)
           
 IVec to3d(IDoubleI z)
           
 IVec4 to4d()
           
 IVec4 to4d(double z, double w)
           
 IVec4 to4d(IDoubleI z, IDoubleI w)
           
 java.lang.String toString()
           
 IVec2 transform(IMatrix2I mat)
          transform with 2x2 transform matrix
 IVec2 transform(IMatrix3I mat)
          transform with 3x3 transform matrix
 IVec2 transform(IVec2I xvec, IVec2I yvec)
          transform with transform vectors
 IVec2 transform(IVec2I xvec, IVec2I yvec, IVec2I translate)
          transform with transform vectors
 IVec2 transform(IVec2 xvec, IVec2 yvec)
          transform with transform vectors
 IVec2 transform(IVec2 xvec, IVec2 yvec, IVec2 translate)
          transform with transform vectors
 IVec2 translate(double x, double y)
          alias of add()
 IVec2 translate(IDoubleI x, IDoubleI y)
          alias of add()
 IVec2 translate(IVec2 v)
          alias of add()
 IVec2 translate(IVec2I v)
          alias of add()
 IVec2 unit()
          unitize (normalize) vector
 double x()
           
 IVec2 x(double vx)
          setting x component
 IVec2 x(IDoubleI vx)
          setting x component
 double x(ISwitchE e)
          getting x component
 IDouble x(ISwitchR r)
          getting x component
 double y()
           
 IVec2 y(double vy)
          setting y component
 IVec2 y(IDoubleI vy)
          setting y component
 double y(ISwitchE e)
          getting y component
 IDouble y(ISwitchR r)
          getting y component
 IVec2 zero()
          setting all zero
 
Methods inherited from class igeo.IParameterObject
createObject, parent, parent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

xaxis

public static IVec2 xaxis

yaxis

public static IVec2 yaxis

x

public double x

y

public double y
Constructor Detail

IVec2

public IVec2()

IVec2

public IVec2(double x,
             double y)

IVec2

public IVec2(IVec2 v)

IVec2

public IVec2(IVec2I v)

IVec2

public IVec2(IDoubleI x,
             IDoubleI y)

IVec2

public IVec2(IVecI v)

IVec2

public IVec2(IVecI v,
             IVecI projectionDir)

IVec2

public IVec2(IVecI v,
             IVecI xaxis,
             IVecI yaxis)

IVec2

public IVec2(IVecI v,
             IVecI xaxis,
             IVecI yaxis,
             IVecI origin)

IVec2

public IVec2(IServerI s)

IVec2

public IVec2(IServerI s,
             double x,
             double y)

IVec2

public IVec2(IServerI s,
             IVec2 v)

IVec2

public IVec2(IServerI s,
             IVec2I v)

IVec2

public IVec2(IServerI s,
             IDoubleI x,
             IDoubleI y)

IVec2

public IVec2(IServerI s,
             IVecI v)

IVec2

public IVec2(IServerI s,
             IVecI v,
             IVecI projectionDir)

IVec2

public IVec2(IServerI s,
             IVecI v,
             IVecI xaxis,
             IVecI yaxis)

IVec2

public IVec2(IServerI s,
             IVecI v,
             IVecI xaxis,
             IVecI yaxis,
             IVecI origin)
Method Detail

x

public double x()
Specified by:
x in interface IVec2I

y

public double y()
Specified by:
y in interface IVec2I

x

public IVec2 x(double vx)
setting x component

Specified by:
x in interface IVec2I

y

public IVec2 y(double vy)
setting y component

Specified by:
y in interface IVec2I

x

public IVec2 x(IDoubleI vx)
setting x component

Specified by:
x in interface IVec2I

y

public IVec2 y(IDoubleI vy)
setting y component

Specified by:
y in interface IVec2I

x

public double x(ISwitchE e)
getting x component

Specified by:
x in interface IVec2I

y

public double y(ISwitchE e)
getting y component

Specified by:
y in interface IVec2I

x

public IDouble x(ISwitchR r)
getting x component

Specified by:
x in interface IVec2I

y

public IDouble y(ISwitchR r)
getting y component

Specified by:
y in interface IVec2I

get

public IVec2 get()
Specified by:
get in interface IParameter
Specified by:
get in interface IVec2I
Specified by:
get in interface IVec2Op

dup

public IVec2 dup()
Specified by:
dup in interface IArithmeticVal<IVec2I,IDoubleI>
Specified by:
dup in interface IVec2I

to3d

public IVec to3d()
Specified by:
to3d in interface IVec2I

to3d

public IVec to3d(double z)
Specified by:
to3d in interface IVec2I

to3d

public IVec to3d(IDoubleI z)
Specified by:
to3d in interface IVec2I

to4d

public IVec4 to4d()
Specified by:
to4d in interface IVec2I

to4d

public IVec4 to4d(double z,
                  double w)
Specified by:
to4d in interface IVec2I

to4d

public IVec4 to4d(IDoubleI z,
                  IDoubleI w)
Specified by:
to4d in interface IVec2I

getX

public IDouble getX()
Specified by:
getX in interface IVec2I

getY

public IDouble getY()
Specified by:
getY in interface IVec2I

set

public IVec2 set(double x,
                 double y)
Specified by:
set in interface IVec2I

set

public IVec2 set(IVec2 v)

set

public IVec2 set(IVec2I v)
Specified by:
set in interface IArithmeticVal<IVec2I,IDoubleI>
Specified by:
set in interface IVec2I

set

public IVec2 set(IDoubleI x,
                 IDoubleI y)
Specified by:
set in interface IVec2I

set

public IVec2 set(IVecI v)

set

public IVec2 set(IVecI v,
                 IVecI projectionDir)

set

public IVec2 set(IVecI v,
                 IVecI xaxis,
                 IVecI yaxis)

set

public IVec2 set(IVecI v,
                 IVecI xaxis,
                 IVecI yaxis,
                 IVecI origin)

add

public IVec2 add(double x,
                 double y)
Specified by:
add in interface IVec2I

add

public IVec2 add(IDoubleI x,
                 IDoubleI y)
Specified by:
add in interface IVec2I

add

public IVec2 add(IVec2 v)

add

public IVec2 add(IVec2I v)
Specified by:
add in interface IArithmeticVal<IVec2I,IDoubleI>
Specified by:
add in interface IVec2I

sub

public IVec2 sub(double x,
                 double y)
Specified by:
sub in interface IVec2I

sub

public IVec2 sub(IDoubleI x,
                 IDoubleI y)
Specified by:
sub in interface IVec2I

sub

public IVec2 sub(IVec2 v)

sub

public IVec2 sub(IVec2I v)
Specified by:
sub in interface IArithmeticVal<IVec2I,IDoubleI>
Specified by:
sub in interface IVec2I

mul

public IVec2 mul(double x)
Specified by:
mul in interface IVec2I

mul

public IVec2 mul(IDouble v)

mul

public IVec2 mul(IDoubleI v)
Specified by:
mul in interface IArithmeticVal<IVec2I,IDoubleI>
Specified by:
mul in interface IVec2I

div

public IVec2 div(double x)
Specified by:
div in interface IVec2I

div

public IVec2 div(IDouble v)

div

public IVec2 div(IDoubleI v)
Specified by:
div in interface IArithmeticVal<IVec2I,IDoubleI>
Specified by:
div in interface IVec2I

neg

public IVec2 neg()
Specified by:
neg in interface IVec2I

rev

public IVec2 rev()
alias of neg

Specified by:
rev in interface IVec2I

flip

public IVec2 flip()
alias of neg

Specified by:
flip in interface IVec2I

zero

public IVec2 zero()
setting all zero

Specified by:
zero in interface IArithmeticVal<IVec2I,IDoubleI>
Specified by:
zero in interface IVec2I

add

public IVec2 add(IVec2 v,
                 double f)
scale add


add

public IVec2 add(IVec2I v,
                 double f)
scale add

Specified by:
add in interface IVec2I

add

public IVec2 add(IVec2I v,
                 IDoubleI f)
scale add

Specified by:
add in interface IVec2I

add

public IVec2 add(double f,
                 IVec2 v)
scale add; alias


add

public IVec2 add(double f,
                 IVec2I v)
scale add; alias

Specified by:
add in interface IVec2I

add

public IVec2 add(IDoubleI f,
                 IVec2I v)
scale add; alias

Specified by:
add in interface IVec2I

dot

public double dot(IVec2 v)
dot product


dot

public double dot(double vx,
                  double vy)
dot product

Specified by:
dot in interface IVec2I

dot

public double dot(IVec2I v)
dot product

Specified by:
dot in interface IVec2I

dot

public double dot(ISwitchE e,
                  IVec2I v)
dot product

Specified by:
dot in interface IVec2I

dot

public IDouble dot(ISwitchR r,
                   IVec2I v)
dot product

Specified by:
dot in interface IVec2I

cross

public IVec cross(IVec2 v)
cross product in z direction as IVec


cross

public IVec cross(double vx,
                  double vy)
cross product in z direction as IVec

Specified by:
cross in interface IVec2I

cross

public IVec cross(IVec2I v)
cross product in z direction as IVec

Specified by:
cross in interface IVec2I

len

public double len()
Description copied from interface: IVec2I
getting length

Specified by:
len in interface IVec2I
Returns:
length (norm) of the vector in double

len

public double len(ISwitchE e)
Description copied from interface: IVec2I
getting length

Specified by:
len in interface IVec2I
Returns:
length (norm) of the vector in double

len

public IDouble len(ISwitchR r)
Description copied from interface: IVec2I
getting length

Specified by:
len in interface IVec2I
Returns:
length (norm) of the vector in double

len2

public double len2()
return squared length of the vector in double

Specified by:
len2 in interface IVec2I

len2

public double len2(ISwitchE e)
return squared length of the vector in double

Specified by:
len2 in interface IVec2I

len2

public IDouble len2(ISwitchR r)
return squared length of the vector in double

Specified by:
len2 in interface IVec2I

len

public IVec2 len(IDoubleI l)
setting length

Specified by:
len in interface IVec2I

len

public IVec2 len(double l)
setting length

Specified by:
len in interface IVec2I

unit

public IVec2 unit()
unitize (normalize) vector

Specified by:
unit in interface IVec2I

ortho

public IVec2 ortho()
rotate vector in Pi/2

Specified by:
ortho in interface IVec2I

dist

public double dist(IVec2 v)
distance of two vectors


dist

public double dist(double vx,
                   double vy)
distance of two vectors

Specified by:
dist in interface IVec2I

dist

public double dist(IVec2I v)
distance of two vectors

Specified by:
dist in interface IVec2I

dist

public double dist(ISwitchE e,
                   IVec2I v)
distance of two vectors

Specified by:
dist in interface IVec2I

dist

public IDouble dist(ISwitchR r,
                    IVec2I v)
distance of two vectors

Specified by:
dist in interface IVec2I

dist2

public double dist2(IVec2 v)
squared distance of two vectors


dist2

public double dist2(double vx,
                    double vy)
squared distance of two vectors

Specified by:
dist2 in interface IVec2I

dist2

public double dist2(IVec2I v)
squared distance of two vectors

Specified by:
dist2 in interface IVec2I

dist2

public double dist2(ISwitchE e,
                    IVec2I v)
squared distance of two vectors

Specified by:
dist2 in interface IVec2I

dist2

public IDouble dist2(ISwitchR r,
                     IVec2I v)
squared distance of two vectors

Specified by:
dist2 in interface IVec2I

eq

public boolean eq(IVec2 v)
whether location is same or not


eq

public boolean eq(double vx,
                  double vy)
whether location is same or not

Specified by:
eq in interface IVec2I

eq

public boolean eq(IVec2I v)
whether location is same or not

Specified by:
eq in interface IVec2I

eq

public boolean eq(ISwitchE e,
                  IVec2I v)
whether location is same or not

Specified by:
eq in interface IVec2I

eq

public IBool eq(ISwitchR r,
                IVec2I v)
whether location is same or not

Specified by:
eq in interface IVec2I

eq

public boolean eq(IVec2 v,
                  double tolerance)
whether location is same or not within tolerance


eq

public boolean eq(double vx,
                  double vy,
                  double tolerance)
whether location is same or not within tolerance

Specified by:
eq in interface IVec2I

eq

public boolean eq(IVec2I v,
                  double tolerance)
whether location is same or not within tolerance

Specified by:
eq in interface IVec2I

eq

public boolean eq(ISwitchE e,
                  IVec2I v,
                  double tolerance)
whether location is same or not within tolerance

Specified by:
eq in interface IVec2I

eq

public IBool eq(ISwitchR r,
                IVec2I v,
                IDoubleI tolerance)
whether location is same or not within tolerance

Specified by:
eq in interface IVec2I

eqX

public boolean eqX(IVec2 v)
check if same in X


eqY

public boolean eqY(IVec2 v)
check if same in Y


eqX

public boolean eqX(double vx)
check if same in X

Specified by:
eqX in interface IVec2I

eqY

public boolean eqY(double vy)
check if same in Y

Specified by:
eqY in interface IVec2I

eqX

public boolean eqX(IVec2I v)
check if same in X

Specified by:
eqX in interface IVec2I

eqY

public boolean eqY(IVec2I v)
check if same in Y

Specified by:
eqY in interface IVec2I

eqX

public boolean eqX(ISwitchE e,
                   IVec2I v)
check if same in X

Specified by:
eqX in interface IVec2I

eqY

public boolean eqY(ISwitchE e,
                   IVec2I v)
check if same in Y

Specified by:
eqY in interface IVec2I

eqX

public IBool eqX(ISwitchR r,
                 IVec2I v)
check if same in X

Specified by:
eqX in interface IVec2I

eqY

public IBool eqY(ISwitchR r,
                 IVec2I v)
check if same in Y

Specified by:
eqY in interface IVec2I

eqX

public boolean eqX(IVec2 v,
                   double tolerance)
check if same in X within tolerance


eqY

public boolean eqY(IVec2 v,
                   double tolerance)
check if same in Y within tolerance


eqX

public boolean eqX(double vx,
                   double tolerance)
check if same in X within tolerance

Specified by:
eqX in interface IVec2I

eqY

public boolean eqY(double vy,
                   double tolerance)
check if same in Y within tolerance

Specified by:
eqY in interface IVec2I

eqX

public boolean eqX(IVec2I v,
                   double tolerance)
check if same in X within tolerance

Specified by:
eqX in interface IVec2I

eqY

public boolean eqY(IVec2I v,
                   double tolerance)
check if same in Y within tolerance

Specified by:
eqY in interface IVec2I

eqX

public boolean eqX(ISwitchE e,
                   IVec2I v,
                   double tolerance)
check if same in X within tolerance

Specified by:
eqX in interface IVec2I

eqY

public boolean eqY(ISwitchE e,
                   IVec2I v,
                   double tolerance)
check if same in Y within tolerance

Specified by:
eqY in interface IVec2I

eqX

public IBool eqX(ISwitchR r,
                 IVec2I v,
                 IDoubleI tolerance)
check if same in X within tolerance

Specified by:
eqX in interface IVec2I

eqY

public IBool eqY(ISwitchR r,
                 IVec2I v,
                 IDoubleI tolerance)
check if same in Y within tolerance

Specified by:
eqY in interface IVec2I

angle

public double angle(IVec2 v)
Returns:
angle of two vector. From -Pi to Pi. Sign follows right-handed screw rule

angle

public double angle(double vx,
                    double vy)
Description copied from interface: IVec2I
angle between two vectors

Specified by:
angle in interface IVec2I
Returns:
angle of two vector. From -Pi to Pi. Sign follows right-handed screw rule

angle

public double angle(IVec2I v)
Description copied from interface: IVec2I
angle between two vectors

Specified by:
angle in interface IVec2I
Returns:
angle of two vector. From -Pi to Pi. Sign follows right-handed screw rule

angle

public double angle(ISwitchE e,
                    IVec2I v)
Description copied from interface: IVec2I
angle between two vectors

Specified by:
angle in interface IVec2I
Returns:
angle of two vector. From -Pi to Pi. Sign follows right-handed screw rule

angle

public IDouble angle(ISwitchR r,
                     IVec2I v)
Description copied from interface: IVec2I
angle between two vectors

Specified by:
angle in interface IVec2I
Returns:
angle of two vector. From -Pi to Pi. Sign follows right-handed screw rule

rot

public IVec2 rot(double angle)
rotate

Specified by:
rot in interface IVec2I

rot

public IVec2 rot(IDoubleI angle)
rotate

Specified by:
rot in interface IVec2I

rot

public IVec2 rot(IVec2 center,
                 double angle)
rotate around center


rot

public IVec2 rot(double centerX,
                 double centerY,
                 double angle)
rotate around center

Specified by:
rot in interface IVec2I

rot

public IVec2 rot(IVec2I center,
                 double angle)
rotate around center

Specified by:
rot in interface IVec2I

rot

public IVec2 rot(IVec2I center,
                 IDoubleI angle)
rotate around center

Specified by:
rot in interface IVec2I

rot

public IVec2 rot(IVec2 destDir)
rotate towards destination direction


rot

public IVec2 rot(IVec2I destDir)
rotate towards destination direction

Specified by:
rot in interface IVec2I

rot

public IVec2 rot(IVec2 center,
                 IVec2 destPt)
rotate around center towards destination point


rot

public IVec2 rot(IVec2I center,
                 IVec2I destPt)
rotate around center towards destination point

Specified by:
rot in interface IVec2I

scale

public IVec2 scale(double f)
alias of mul

Specified by:
scale in interface IVec2I

scale

public IVec2 scale(IDoubleI f)
alias of mul

Specified by:
scale in interface IVec2I

scale

public IVec2 scale(IVec2 center,
                   double f)
scale around center


scale

public IVec2 scale(double centerX,
                   double centerY,
                   double f)
scale around center

Specified by:
scale in interface IVec2I

scale

public IVec2 scale(IVec2I center,
                   double f)
scale around center

Specified by:
scale in interface IVec2I

scale

public IVec2 scale(IVec2I center,
                   IDoubleI f)
scale around center

Specified by:
scale in interface IVec2I

scale1d

public IVec2 scale1d(IVec2 axis,
                     double f)
scale only in 1 direction


scale1d

public IVec2 scale1d(IVec2I axis,
                     double f)
scale only in 1 direction

Specified by:
scale1d in interface IVec2I

scale1d

public IVec2 scale1d(IVec2I axis,
                     IDoubleI f)
scale only in 1 direction

Specified by:
scale1d in interface IVec2I

scale1d

public IVec2 scale1d(double axisX,
                     double axisY,
                     double f)
scale only in 1 direction

Specified by:
scale1d in interface IVec2I

scale1d

public IVec2 scale1d(IVec2 center,
                     IVec2 axis,
                     double f)
scale only in 1 direction from a center


scale1d

public IVec2 scale1d(IVec2I center,
                     IVec2I axis,
                     double f)
scale only in 1 direction from a center

Specified by:
scale1d in interface IVec2I

scale1d

public IVec2 scale1d(IVec2I center,
                     IVec2I axis,
                     IDoubleI f)
scale only in 1 direction from a center

Specified by:
scale1d in interface IVec2I

scale1d

public IVec2 scale1d(double centerX,
                     double centerY,
                     double axisX,
                     double axisY,
                     double f)
scale only in 1 direction from a center

Specified by:
scale1d in interface IVec2I

ref

public IVec2 ref(IVec2 lineDir)
reflect (mirror) 2 dimensionally to the other side of the line

Parameters:
lineDir - direction of reflection line

ref

public IVec2 ref(double lineX,
                 double lineY)
reflect (mirror) 2 dimensionally to the other side of the line

Specified by:
ref in interface IVec2I

ref

public IVec2 ref(IVec2I lineDir)
reflect (mirror) 2 dimensionally to the other side of the line

Specified by:
ref in interface IVec2I
Parameters:
lineDir - direction of reflection line

ref

public IVec2 ref(IVec2 linePt,
                 IVec2 lineDir)
reflect (mirror) 2 dimensionally to the other side of the line

Parameters:
linePt - start point of reflection line
lineDir - direction of reflection line

ref

public IVec2 ref(double linePtX,
                 double linePtY,
                 double lineDirX,
                 double lineDirY)
reflect (mirror) 2 dimensionally to the other side of the line at line point

Specified by:
ref in interface IVec2I

ref

public IVec2 ref(IVec2I linePt,
                 IVec2I lineDir)
reflect (mirror) 2 dimensionally to the other side of the line

Specified by:
ref in interface IVec2I
Parameters:
linePt - start point of reflection line
lineDir - direction of reflection line

mirror

public IVec2 mirror(IVec2 lineDir)
reflect (mirror) 2 dimensionally to the other side of the line

Parameters:
lineDir - direction of reflection line

mirror

public IVec2 mirror(double lineX,
                    double lineY)
reflect (mirror) 2 dimensionally to the other side of the line

Specified by:
mirror in interface IVec2I

mirror

public IVec2 mirror(IVec2I lineDir)
reflect (mirror) 2 dimensionally to the other side of the line

Specified by:
mirror in interface IVec2I
Parameters:
lineDir - direction of reflection line

mirror

public IVec2 mirror(IVec2 linePt,
                    IVec2 lineDir)
reflect (mirror) 2 dimensionally to the other side of the line

Parameters:
linePt - start point of reflection line
lineDir - direction of reflection line

mirror

public IVec2 mirror(double linePtX,
                    double linePtY,
                    double lineDirX,
                    double lineDirY)
reflect (mirror) 2 dimensionally to the other side of the line at line point

Specified by:
mirror in interface IVec2I

mirror

public IVec2 mirror(IVec2I linePt,
                    IVec2I lineDir)
reflect (mirror) 2 dimensionally to the other side of the line

Specified by:
mirror in interface IVec2I
Parameters:
linePt - start point of reflection line
lineDir - direction of reflection line

shear

public IVec2 shear(double sxy,
                   double syx)
shear operation on XY

Specified by:
shear in interface IVec2I

shear

public IVec2 shear(IDoubleI sxy,
                   IDoubleI syx)
shear operation on XY

Specified by:
shear in interface IVec2I

shear

public IVec2 shear(IVec2I center,
                   double sxy,
                   double syx)
shear operation on XY

Specified by:
shear in interface IVec2I

shear

public IVec2 shear(IVec2I center,
                   IDoubleI sxy,
                   IDoubleI syx)
shear operation on XY

Specified by:
shear in interface IVec2I

translate

public IVec2 translate(double x,
                       double y)
alias of add()

Specified by:
translate in interface IVec2I

translate

public IVec2 translate(IDoubleI x,
                       IDoubleI y)
alias of add()

Specified by:
translate in interface IVec2I

translate

public IVec2 translate(IVec2 v)
alias of add()


translate

public IVec2 translate(IVec2I v)
alias of add()

Specified by:
translate in interface IVec2I

transform

public IVec2 transform(IMatrix2I mat)
transform with 2x2 transform matrix

Specified by:
transform in interface IVec2I

transform

public IVec2 transform(IMatrix3I mat)
transform with 3x3 transform matrix

Specified by:
transform in interface IVec2I

transform

public IVec2 transform(IVec2 xvec,
                       IVec2 yvec)
transform with transform vectors


transform

public IVec2 transform(IVec2I xvec,
                       IVec2I yvec)
transform with transform vectors

Specified by:
transform in interface IVec2I

transform

public IVec2 transform(IVec2 xvec,
                       IVec2 yvec,
                       IVec2 translate)
transform with transform vectors


transform

public IVec2 transform(IVec2I xvec,
                       IVec2I yvec,
                       IVec2I translate)
transform with transform vectors

Specified by:
transform in interface IVec2I

mv

public IVec2 mv(double x,
                double y)
mv() is alias of add()

Specified by:
mv in interface IVec2I

mv

public IVec2 mv(IDoubleI x,
                IDoubleI y)
mv() is alias of add()

Specified by:
mv in interface IVec2I

mv

public IVec2 mv(IVec2 v)
mv() is alias of add()


mv

public IVec2 mv(IVec2I v)
mv() is alias of add()

Specified by:
mv in interface IVec2I

cp

public IVec2 cp()
cp() is alias of dup()

Specified by:
cp in interface IArithmeticVal<IVec2I,IDoubleI>
Specified by:
cp in interface IVec2I

cp

public IVec2 cp(double x,
                double y)
cp() is alias of dup().add()

Specified by:
cp in interface IVec2I

cp

public IVec2 cp(IDoubleI x,
                IDoubleI y)
cp() is alias of dup().add()

Specified by:
cp in interface IVec2I

cp

public IVec2 cp(IVec2 v)
cp() is alias of dup().add()


cp

public IVec2 cp(IVec2I v)
cp() is alias of dup().add()

Specified by:
cp in interface IVec2I

dif

public IVec2 dif(IVec2 v)
create a new instance of difference


dif

public IVec2 dif(double vx,
                 double vy)
create a new instance of difference

Specified by:
dif in interface IVec2I

dif

public IVec2 dif(IVec2I v)
create a new instance of difference

Specified by:
dif in interface IVec2I

diff

public IVec2 diff(IVec2 v)
alias of dif


diff

public IVec2 diff(double vx,
                  double vy)
alias of dif

Specified by:
diff in interface IVec2I

diff

public IVec2 diff(IVec2I v)
alias of dif

Specified by:
diff in interface IVec2I

mid

public IVec2 mid(IVec2 v)
create a new instance of midpoint


mid

public IVec2 mid(double vx,
                 double vy)
create a new instance of midpoint

Specified by:
mid in interface IVec2I

mid

public IVec2 mid(IVec2I v)
create a new instance of midpoint

Specified by:
mid in interface IVec2I

sum

public IVec2 sum(IVec2 v)
create a new instance of summation


sum

public IVec2 sum(double vx,
                 double vy)
create a new instance of summation

Specified by:
sum in interface IVec2I

sum

public IVec2 sum(IVec2I v)
create a new instance of summation

Specified by:
sum in interface IVec2I

sum

public IVec2 sum(IVec2I... v)
create a new instance of summation

Specified by:
sum in interface IVec2I

bisect

public IVec2 bisect(IVec2 v)
create a new instance of bisector


bisect

public IVec2 bisect(double vx,
                    double vy)
create a new instance of bisector

Specified by:
bisect in interface IVec2I

bisect

public IVec2 bisect(IVec2I v)
create a new instance of bisector

Specified by:
bisect in interface IVec2I

sum

public IVec2 sum(IVec2 v2,
                 double w1,
                 double w2)
create a new instance of weighted sum


sum

public IVec2 sum(IVec2I v2,
                 double w1,
                 double w2)
create a new instance of weighted sum

Specified by:
sum in interface IVec2I

sum

public IVec2 sum(IVec2I v2,
                 IDoubleI w1,
                 IDoubleI w2)
create a new instance of weighted sum

Specified by:
sum in interface IVec2I

sum

public IVec2 sum(IVec2 v2,
                 double w2)
create a new instance of weighted sum


sum

public IVec2 sum(IVec2I v2,
                 double w2)
create a new instance of weighted sum

Specified by:
sum in interface IVec2I

sum

public IVec2 sum(IVec2I v2,
                 IDoubleI w2)
create a new instance of weighted sum

Specified by:
sum in interface IVec2I

nml

public IVec nml(IVec2 v)
alias of cross


nml

public IVec nml(IVec2I v)
alias of cross

Specified by:
nml in interface IVec2I

nml

public IVecI nml(double vx,
                 double vy)
alias of cross

Specified by:
nml in interface IVec2I

nml

public IVecI nml(IVec2 pt1,
                 IVec2 pt2)
create normal vector from 3 points of self, pt1 and pt2


nml

public IVecI nml(double vx1,
                 double vy1,
                 double vx2,
                 double vy2)
create normal vector from 3 points of self, pt1 and pt2

Specified by:
nml in interface IVec2I

nml

public IVecI nml(IVec2I pt1,
                 IVec2I pt2)
create normal vector from 3 points of self, pt1 and pt2

Specified by:
nml in interface IVec2I

isParallel

public boolean isParallel(IVec2I v)
check if two vectors are parallel


isParallel

public boolean isParallel(IVec2I v,
                          double angleReso)
check if two vectors are parallel


isStraight

public boolean isStraight(IVec2I v1,
                          IVec2I v2)
check if three locations are on straight line


isStraight

public boolean isStraight(IVec2I v1,
                          IVec2I v2,
                          double angleReso)
check if three locations are on straight line


intersect

public static IVec2 intersect(IVec2I pt1,
                              IVec2I dir1,
                              IVec2I pt2,
                              IVec2I dir2)
intersection of two infinite lines


intersectYLine

public static IVec2 intersectYLine(IVec2 linePt,
                                   IVec2 lineDir,
                                   double xOfYLine)

intersectXLine

public static IVec2 intersectXLine(IVec2 linePt,
                                   IVec2 lineDir,
                                   double yOfXLine)

intersectSegment

public static IVec2 intersectSegment(IVec2I line1pt1,
                                     IVec2I line1pt2,
                                     IVec2I line2pt1,
                                     IVec2I line2pt2)

intersectPolyline

public static IVec2 intersectPolyline(IVec2I p1,
                                      IVec2I p2,
                                      IVec2I[] pts,
                                      boolean closed)

intersectPolyline

public static IVec2 intersectPolyline(IVec2I p1,
                                      IVec2I p2,
                                      IVec2I[] pts)

intersectPolygon

public static IVec2 intersectPolygon(IVec2I p1,
                                     IVec2I p2,
                                     IVec2I[] pts)

intersectSegmentAndXLine

public static IVec2 intersectSegmentAndXLine(IVec2I linePt1,
                                             IVec2I linePt2,
                                             double y)

intersectSegmentAndYLine

public static IVec2 intersectSegmentAndYLine(IVec2I linePt1,
                                             IVec2I linePt2,
                                             double x)

intersectLineAndCircle

public static IVec2[] intersectLineAndCircle(IVec2I linePt,
                                             IVec2I lineDir,
                                             IVec2I circleCenter,
                                             double radius)
intersection of an infinite line and a circle


removeStraightPoints

public static IVec2I[] removeStraightPoints(IVec2I[] pts,
                                            boolean closed)
remove points which are on straight line of adjacents


removeDuplicatedPoints

public static IVec2I[] removeDuplicatedPoints(IVec2I[] pts,
                                              boolean closed)

isInside

public boolean isInside(IVec2I[] pts)
determine if the point is insde the polygon defined by the argument


isInside

public boolean isInside(IVec2[] pts)
determine if the point is insde the polygon defined by the argument true if the point is on the edge of polygon


isValid

public boolean isValid()
checking x, y is valid number (not Infinite, nor NaN).

Specified by:
isValid in interface IVec2I

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

distToLine

public double distToLine(IVec2 pt1,
                         IVec2 pt2)
distance to an infinite line issue: there is another distToLine(IVecI lineDir,IVecI linePt) method


isOnLine

public boolean isOnLine(IVec2 pt1,
                        IVec2 pt2)

isBetween

public boolean isBetween(IVec2I pt1,
                         IVec2I pt2)

projectTo2Vec

public double[] projectTo2Vec(IVec2I v1,
                              IVec2I v2)
project the vector to the plane defined by two input vector and decompose vector to two vector and another perpendicular vector and returns coefficient of them. relationship of them is like below. this = return[0] * v1 + return[1] * v2 ;

Returns:
array of three double number, first is coefficient of uvec, second is of vvec

perpendicularVecToLine

public IVec2 perpendicularVecToLine(IVec2I lineDir,
                                    IVec2I linePt)
create a new vector from this point to the line in parpendicular direction.


perpendicularVecToLine

public IVec2 perpendicularVecToLine(IVec2I lineDir)
create a new vector from line to this point perpendicular to the line dir


distToLine

public double distToLine(IVec2I lineDir,
                         IVec2I linePt)
distance to an infinite line


distToLine

public double distToLine(IVec2I lineDir)
distance to a line dir


distToSegment

public double distToSegment(IVec2I linePt1,
                            IVec2I linePt2)
distance to a line segment


ratioOnSegment

public double ratioOnSegment(IVec2I linePt1,
                             IVec2I linePt2)
ratio of projected point between two points (line segment). 0.0 is at linePt1, 1.0 is at linePt2.


distToTriangle

public double distToTriangle(IVec2I pt1,
                             IVec2I pt2,
                             IVec2I pt3)
distance to a triangle