當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。