当前位置: 首页>>代码示例>>Java>>正文


Java Point2D.transform方法代码示例

本文整理汇总了Java中math.geom2d.Point2D.transform方法的典型用法代码示例。如果您正苦于以下问题:Java Point2D.transform方法的具体用法?Java Point2D.transform怎么用?Java Point2D.transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在math.geom2d.Point2D的用法示例。


在下文中一共展示了Point2D.transform方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toGlobal

import math.geom2d.Point2D; //导入方法依赖的package包/类
/**
 * transform a point in local coordinate (ie orthogonal centered hyberbola
 * with a=b=1) to global coordinate system.
 */
public Point2D toGlobal(Point2D point) {
    point = point.transform(AffineTransform2D.createScaling(a, b));
    point = point.transform(AffineTransform2D.createRotation(theta));
    point = point.transform(AffineTransform2D.createTranslation(xc, yc));
    return point;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:11,代码来源:Hyperbola2D.java

示例2: transform

import math.geom2d.Point2D; //导入方法依赖的package包/类
/**
 * Returns an instance of EllipseArc2D, or CircleArc2D if transform is a
 * similarity.
 */
@Override
public EllipseArc2D transform(AffineTransform2D trans) {
    if (!AffineTransform2D.isSimilarity(trans))
        return super.transform(trans);

    // System.out.println("transform a circle");

    // extract the control points
    Point2D center = circle.getCenter();
    Point2D point1 = this.getFirstPoint();
    Point2D point2 = this.getLastPoint();

    // transform each point
    center = center.transform(trans);
    point1 = point1.transform(trans);
    point2 = point2.transform(trans);

    // compute new angles
    double angle1 = Angle2D.getHorizontalAngle(center, point1);
    double angle2 = Angle2D.getHorizontalAngle(center, point2);

    // compute factor of transform
    double[] coefs = trans.getCoefficients();
    double factor = Math.sqrt(coefs[0]*coefs[0]+coefs[3]*coefs[3]);

    // compute parameters of new circle arc
    double xc = center.getX(), yc = center.getY();
    double r2 = circle.getRadius()*factor;
    double startAngle = angle1;
    double angleExtent = Angle2D.formatAngle(angle2-angle1);

    boolean b1 = AffineTransform2D.isDirect(trans);
    boolean b2 = this.isDirect();
    if (b1&!b2|!b1&b2)
        angleExtent = angleExtent-2*Math.PI;

    // return new CircleArc
    return new CircleArc2D(xc, yc, r2, startAngle, angleExtent);
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:44,代码来源:CircleArc2D.java

示例3: formatPoint

import math.geom2d.Point2D; //导入方法依赖的package包/类
/**
 * Changes coordinate of the point to correspond to a standard parabola.
 * Standard parabola s such that y=x^2 for every point of the parabola.
 * 
 * @param point
 * @return
 */
private Point2D formatPoint(java.awt.geom.Point2D point) {
    Point2D p2 = new Point2D(point);
    p2 = p2.transform(AffineTransform2D.createTranslation(-xv, -yv));
    p2 = p2.transform(AffineTransform2D.createRotation(-theta));
    p2 = p2.transform(AffineTransform2D.createScaling(1, 1.0/a));
    return p2;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:15,代码来源:Parabola2D.java

示例4: toLocal

import math.geom2d.Point2D; //导入方法依赖的package包/类
public Point2D toLocal(Point2D point) {
    point = point.transform(AffineTransform2D.createTranslation(-xc, -yc));
    point = point.transform(AffineTransform2D.createRotation(-theta));
    point = point.transform(AffineTransform2D.createScaling(1/a, 1/b));
    return point;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:7,代码来源:Hyperbola2D.java


注:本文中的math.geom2d.Point2D.transform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。