Java 类javax.vecmath.Tuple2d 实例源码

项目:kendzi-math    文件:AngleUtil.java   
public static double angleBetweenOriented(Tuple2d tip1, Tuple2d tail, Tuple2d tip2) {
    double a1 = angle(tail, tip1);
    double a2 = angle(tail, tip2);
    double angDel = a2 - a1;

    if (angDel <= -Math.PI) {
        return angDel + PI_2;
    }
    if (angDel > Math.PI) {
        return angDel - PI_2;
    }
    return angDel;
}
项目:kendzi-math    文件:PointUtil.java   
/**
 * @see http://en.wikipedia.org/wiki/Transformation_matrix
 * @param pTuple
 * @param pAngle
 * @return
 */
public static Vector2d rotateCounterClockwise2d(Tuple2d pTuple, double pAngle) {
    double cosA = Math.cos(pAngle);
    double sinA = Math.sin(pAngle);
    return new Vector2d(
            pTuple.x * cosA - pTuple.y * sinA,
            pTuple.x * sinA + pTuple.y * cosA);
}
项目:kendzi-math    文件:PointUtil.java   
/**
 * @see http://en.wikipedia.org/wiki/Transformation_matrix
 * @param pTuple
 * @param pAngle
 * @return
 */
public static Vector2d rotateClockwise2d(Tuple2d pTuple, double pAngle) {
    double cosA = Math.cos(pAngle);
    double sinA = Math.sin(pAngle);
    return new Vector2d(
            pTuple.x * cosA + pTuple.y * sinA,
            - pTuple.x * sinA + pTuple.y * cosA);
}
项目:Analyst    文件:TextureFP.java   
public TextureFP(FacialPointType type, Tuple2d point) {
    this.type = type;
    this.x = (float) point.x;
    this.y = (float) point.y;
}
项目:siteplan    文件:NaturalStepUI.java   
@Override
public void moveLoop(Loop<Bar> draggedLoop, Tuple2d offset)
{
    // do nothing
}
项目:siteplan    文件:ProfileUI.java   
@Override
public void moveLoop( Loop<Bar> draggedLoop, Tuple2d offset ) {
    return; // no thx!
}
项目:kendzi-math    文件:AngleUtil.java   
public static double angle(Tuple2d p0, Tuple2d p1) {
    double dx = p1.x - p0.x;
    double dy = p1.y - p0.y;
    return Math.atan2(dy, dx);
}
项目:kendzi-math    文件:AngleUtil.java   
public static double angle(Tuple2d p) {
    return Math.atan2(p.y, p.x);
}
项目:kendzi-math    文件:Algebra.java   
/**
  * <code>
  * <pre>
  *
  *  unitVector
  *    ^
  *    |
  *    |
  *    + -- ^ vectorToProject
  *    |   /
  *    |  /
  *    | /
  *    |/
  *    0
  * </pre>
  * </code>
  *
  *
  * @see http://en.wikipedia.org/wiki/Vector_projection
  * @param unitVector
  * @param vectorToProject
  * @return
  */
public static Vector2d orthogonalProjection(Vector2d unitVector, Tuple2d vectorToProject) {
    Vector2d n = new Vector2d(unitVector);
    n.normalize();

    double px = vectorToProject.x;
    double py = vectorToProject.y;

    double ax = n.x;
    double ay = n.y;

    return new Vector2d(
            px * ax * ax   + py * ax * ay,
            px * ax * ay   + py * ay * ay
         );
}
项目:kendzi-math    文件:Point2dUtil.java   
public static Point2d sub(Tuple2d p1, Tuple2d p2) {
    return new Point2d(p1.x - p2.x, p1.y - p2.y );
}
项目:kendzi-math    文件:Skeleton.java   
/**
 * Computes the distance between this point and point p1.
 *
 * @param p0
 *
 * @param p1
 *            the other point
 * @return
 */
private static double distance(Tuple2d p0, Tuple2d p1) {
    double dx, dy;

    dx = p0.x - p1.x;
    dy = p0.y - p1.y;
    return Math.sqrt(dx * dx + dy * dy);
}
项目:kendzi-math    文件:Tuple2dUtil.java   
/**
 * Computes the distance between this point and point p1.
 * 
 * @param p0
 * 
 * @param p1
 *            the other point
 * @return
 */
public static double distance(Tuple2d p0, Tuple2d p1) {
    double dx, dy;

    dx = p0.x - p1.x;
    dy = p0.y - p1.y;
    return Math.sqrt(dx * dx + dy * dy);
}
项目:geoxygene    文件:MathUtil.java   
/**
 * add two points
 * @param p point to fill
 * @param pA first point to add
 * @param pB second point to add
 */
public static Point2d add(final Point2d p, final Point2d pA, final Tuple2d pB) {
  p.x = pB.x + pA.x;
  p.y = pB.y + pA.y;
  return p;
}
项目:geoxygene    文件:MathUtil.java   
/**
 * add two points
 * @param p point to fill
 * @param x1Pixel first point to add
 * @param nPixel second point to add
 */
public static Point2d add(final Point2d pA, final Tuple2d v) {
  return add(new Point2d(), pA, v);
}
项目:kendzi-math    文件:LinePoints2d.java   
/** Determinate if point is over line or on line.
 * @param pPoint point
 * @return point is over line or on line
 * TODO RENAME TO POINT_IN_FRONT
 */
public boolean inFront(Tuple2d pPoint) {
    return LineUtil.matrixDet(this.p1, this.p2, pPoint) >= 0;
}
项目:kendzi-math    文件:LineLinear2d.java   
/** Determinate if point is under line.
 * <img src="doc-files/LineLinear2d_point.png">
 * @param pPoint point
 * @return point is under line
 */
public boolean pointIsUnder(Tuple2d pPoint) {
    // XXX veryfy if it have sense
    return A * pPoint.x + B * pPoint.y + C > 0;
}
项目:kendzi-math    文件:LineLinear2d.java   
/** Determinate if point is over line.
 * <img src="doc-files/LineLinear2d_point.png">
 * @param pPoint point
 * @return point is over line
 */
public boolean pointIsOver(Tuple2d pPoint) {
    // XXX veryfy if it have sense
    return A * pPoint.x + B * pPoint.y + C < 0;
}
项目:kendzi-math    文件:LineLinear2d.java   
/** Determinate if point is on line.
 * <img src="doc-files/LineLinear2d_point.png">
 * <img src="doc-files/test.png">
 * @param pPoint point
 * @return point is on line
 */
public boolean pointIsOn(Tuple2d pPoint) {
    return A * pPoint.x + B * pPoint.y + C == 0;
}
项目:kendzi-math    文件:LineLinear2d.java   
/** Determinate if point is over line or on line.
 * <img src="doc-files/LineLinear2d_point.png">
 * @param pPoint point
 * @return point is over line or on line
 */
public boolean pointInFront(Tuple2d pPoint) {
    // XXX veryfy if it have sense
    return A * pPoint.x + B * pPoint.y + C >= 0;
}
项目:kendzi-math    文件:LineLinear2d.java   
/** Determinate if point is under line or on line.
 * <img src="doc-files/LineLinear2d_point.png">
 * @param pPoint point
 * @return point is under line or on line
 */
public boolean pointInBack(Tuple2d pPoint) {
    // XXX veryfy if it have sense
    return A * pPoint.x + B * pPoint.y + C <= 0;
}
项目:kendzi-math    文件:LineUtil.java   
/** Det of matrix.
 * @param A first column of matrix
 * @param B second column of matrix
 * @param Z third column of matrix
 * @return det of matrix
 */
public static double matrixDet(Point2d A, Point2d B, Tuple2d Z) {
    return A.x * B.y + B.x * Z.y + Z.x * A.y - Z.x * B.y - A.x * Z.y - B.x * A.y;
}
项目:kendzi-math    文件:Vector2dUtil.java   
/**
 * Cross product for 2d is same as doc
 * 
 * @param u
 * @param v
 * @return
 * @see {http://mathworld.wolfram.com/CrossProduct.html}
 */
public static double cross(Tuple2d u, Tuple2d v) {
    return u.x * v.y - u.y * v.x;
}
项目:kendzi-math    文件:RectangleUtil.java   
/**
 * Computes the dot product of the v1 vector and vector v2. Parameter can be
 * point then vector will start from origin and to point.
 * 
 * @param v1 first vector
 * @param v2 second vector
 * @return dot product
 * XXX
 */
private final static double dot(Tuple2d v1, Tuple2d v2) {
    return v1.x*v2.x + v1.y*v2.y;
}