From 2f80aaf62144f6ea315334335ad46fbe0ab911e8 Mon Sep 17 00:00:00 2001 From: lsh <lsh@163.com> Date: 星期五, 18 十月 2024 14:52:02 +0800 Subject: [PATCH] * --- src/main/java/com/zy/asrs/utils/Utils.java | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 114 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/zy/asrs/utils/Utils.java b/src/main/java/com/zy/asrs/utils/Utils.java index cc7426b..fd24456 100644 --- a/src/main/java/com/zy/asrs/utils/Utils.java +++ b/src/main/java/com/zy/asrs/utils/Utils.java @@ -1,9 +1,12 @@ package com.zy.asrs.utils; import com.core.common.Arith; +import com.core.common.Cools; +import com.zy.core.properties.SlaveProperties; -import java.math.BigDecimal; import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.List; /** * Created by vincent on 2020/8/27 @@ -19,4 +22,114 @@ return (float) Arith.multiplys(2, f, 1); } + /** + * 閫氳繃搴撲綅鍙疯幏鍙� 鎺� + */ + public static int getRow(String locNo) { + if (!Cools.isEmpty(locNo)) { + return Integer.parseInt(locNo.substring(0, 2)); + } + throw new RuntimeException("搴撲綅瑙f瀽寮傚父"); + } + + /** + * 閫氳繃搴撲綅鍙疯幏鍙� 鎺� + */ + public static int getBay(String locNo) { + if (!Cools.isEmpty(locNo)) { + return Integer.parseInt(locNo.substring(2, 5)); + } + throw new RuntimeException("搴撲綅瑙f瀽寮傚父"); + } + + /** + * 閫氳繃搴撲綅鍙疯幏鍙� 鎺� + */ + public static int getLev(String locNo) { + if (!Cools.isEmpty(locNo)) { + return Integer.parseInt(locNo.substring(5, 7)); + } + throw new RuntimeException("搴撲綅瑙f瀽寮傚父"); + } + + public static void main(String[] args) { + double[] lev = RingThroughXY(183.0, 1830.0); + System.out.printf("鐐圭殑鍧愭爣涓�: (%.2f, %.2f)%n", lev[0], lev[1]); + } + + public static double[] RingThroughXY(double a,double b) { +// while (true){ +// if (b>=a){ +// b=b-a; +// }else { +// break; +// } +// } + double l = b/a; + // 宸茬煡鏁版嵁 + double circumference = 314; // 鍦嗗懆闀� + double arcLength = 314*l; // 缁欏嚭鐨勫姬闀� + + // 璁$畻鍦嗙殑鍗婂緞 + double radius = circumference / (2 * Math.PI); + + // 鍦嗗績鍧愭爣 + double centerX = 50; + double centerY = 50; + + // 姹傚姬搴� + double theta = arcLength / radius; + + // 璁$畻鐐圭殑鍧愭爣 + double x = 100-(centerX + radius * Math.cos(theta)); + double y = centerY + radius * Math.sin(theta); + + return new double[]{x,y}; + } + + public static double[] RingThroughXYRgv(double a,double b) { + double l = b / a; + + // 鍦嗙殑宸茬煡鍙傛暟 + double radius = 47.52; // 鍗婂緞涓�48 +// double circumference = ; // 璁$畻鍦嗗懆闀� + double arcLength = 2 * Math.PI * radius * l; // 缁欏嚭鐨勫姬闀� + + // 鍦嗗績鍧愭爣 + double centerX = 50; + double centerY = 50; + + // 姹傚姬搴� + double theta = arcLength / radius; + + // 璁$畻鐐圭殑鍧愭爣 + double x = 100-(centerX + radius * Math.cos(theta)); + double y = centerY + radius * Math.sin(theta); + + return new double[]{x, y}; + } + + public static double[] RingThroughXYSta(double a,double b) { + double l = b / a; + + // 鍦嗙殑宸茬煡鍙傛暟 + double radius = 50; // 鍗婂緞涓�48 +// double circumference = ; // 璁$畻鍦嗗懆闀� + double arcLength = 2 * Math.PI * radius * l; // 缁欏嚭鐨勫姬闀� + + // 鍦嗗績鍧愭爣 + double centerX = 55; + double centerY = 45; + + // 姹傚姬搴� + double theta = arcLength / radius; + + // 璁$畻鐐圭殑鍧愭爣 + double x = 100-(centerX + radius * Math.cos(theta)); + double y = centerY + radius * Math.sin(theta); + + return new double[]{x, y}; + } + + } -- Gitblit v1.9.1