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


Java FloatPoint.rotate方法代码示例

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


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

示例1: board_to_screen

import geometry.planar.FloatPoint; //导入方法依赖的package包/类
/**
 * transform a geometry.planar.FloatPoint to a java.awt.geom.Point2D
 */
public Point2D board_to_screen(FloatPoint p_point)
{
    FloatPoint rotated_point = p_point.rotate(this.rotation, this.rotation_pole);
    
    double x, y;
    if (this.mirror_left_right)
    {
        x =  (design_box_with_offset.width() - rotated_point.x - 1) * scale_factor + display_x_offset;
    }
    else
    {
        x = rotated_point.x * scale_factor - display_x_offset;
    }
    if (this.mirror_top_bottom)
    {
        y = (design_box_with_offset.height() - rotated_point.y - 1) * scale_factor + display_y_offset;
    }
    else
    {
        y = rotated_point.y * scale_factor - display_y_offset;
    }
    return new Point2D.Double(x, y);
}
 
开发者ID:andrasfuchs,项目名称:BioBalanceDetector,代码行数:27,代码来源:CoordinateTransform.java

示例2: screen_to_board

import geometry.planar.FloatPoint; //导入方法依赖的package包/类
/**
 * Transform a java.awt.geom.Point2D to a geometry.planar.FloatPoint
 */
public FloatPoint screen_to_board(Point2D p_point)
{
    double x, y;
    if (this.mirror_left_right)
    {
        x = design_box_with_offset.width() -(p_point.getX() - display_x_offset) / scale_factor - 1;
    }
    else
    {
        x =  (p_point.getX() + display_x_offset)/ scale_factor;
    }
    if (this.mirror_top_bottom)
    {
        y = design_box_with_offset.height() -(p_point.getY() - display_y_offset) / scale_factor - 1;
    }
    else
    {
        y =  (p_point.getY() + display_y_offset)/ scale_factor;
    }
    FloatPoint result = new FloatPoint(x, y);
    return result.rotate(-this.rotation, this.rotation_pole);
}
 
开发者ID:andrasfuchs,项目名称:BioBalanceDetector,代码行数:26,代码来源:CoordinateTransform.java

示例3: relative_location

import geometry.planar.FloatPoint; //导入方法依赖的package包/类
/**
 * Calculates the relative location of this pin to its component.
 */
public Vector relative_location()
{
    Component component = board.components.get(this.get_component_no());
    Package  lib_package = component.get_package();
    Package.Pin package_pin = lib_package.get_pin(this.pin_no);
    Vector rel_location = package_pin.relative_location;
    double component_rotation = component.get_rotation_in_degree();
    if (!component.placed_on_front() && !board.components.get_flip_style_rotate_first())
    {
        rel_location = package_pin.relative_location.mirror_at_y_axis();
    }
    if (component_rotation % 90 == 0)
    {
        int component_ninety_degree_factor = ((int) component_rotation )/ 90;
        if (component_ninety_degree_factor != 0)
        {
            rel_location = rel_location.turn_90_degree(component_ninety_degree_factor);
        }
    }
    else
    {
        // rotation may be not exact
        FloatPoint location_approx = rel_location.to_float();
        location_approx = location_approx.rotate(Math.toRadians(component_rotation), FloatPoint.ZERO);
        rel_location = location_approx.round().difference_by(Point.ZERO);
    }
    if (!component.placed_on_front() && board.components.get_flip_style_rotate_first())
    {
        rel_location = rel_location.mirror_at_y_axis();
    }
    return rel_location;
}
 
开发者ID:andrasfuchs,项目名称:BioBalanceDetector,代码行数:36,代码来源:Pin.java


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