From 204d411e545412dc65545b1b9149479a6d07672a Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期六, 14 九月 2024 14:46:49 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/utils/Utils.java |  100 ++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 88 insertions(+), 12 deletions(-)

diff --git a/src/main/java/com/zy/asrs/utils/Utils.java b/src/main/java/com/zy/asrs/utils/Utils.java
index 31ebd6a..f0955c7 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,18 +22,91 @@
         return (float) Arith.multiplys(2, f, 1);
     }
 
-    public static String zerofill(String msg, Integer count){
-        if (msg.length() == count){
-            return msg;
-        } else if (msg.length() > count){
-            return msg.substring(0, 16);
-        } else {
-            StringBuilder msgBuilder = new StringBuilder(msg);
-            for (int i = 0; i<count-msg.length(); i++){
-                msgBuilder.insert(0,"0");
-            }
-            return msgBuilder.toString();
+    /**
+     * 閫氳繃搴撲綅鍙疯幏鍙� 鎺�
+     */
+    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[] RingThroughXY2(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};
     }
 
 

--
Gitblit v1.9.1