Advertisement
dartmeadow

Mantis Duration Publishing

Jan 15th, 2023
1,028
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 5.33 KB | Science | 0 0
  1. import PlaygroundSupport
  2. import Foundation
  3. import SwiftUI
  4. import PDFKit
  5. import SceneKit
  6. import UniformTypeIdentifiers
  7. import SafariServices
  8.  
  9.  
  10. class MantisGimbal: ObservableObject {
  11.     @Published var npointX: Double = 0.0 {
  12.         didSet { MGimbal() }
  13.     }
  14.     @Published var npointY: Double = 0.0 {
  15.         didSet { MGimbal() }
  16.     }
  17.     @Published var durXY: Double = 0.0
  18.    
  19.     func MGimbal() {
  20.         let rofy =  pow(npointX + npointY, 2)
  21.         durXY = cbrt(rofy)
  22.     }
  23.    
  24.    
  25.    
  26.     /*
  27.      func updateVolscale() {
  28.      let cubemassatomscale = (((2 / (cbrt(1 * 2))) + radicalmassscale) - 1) + radicalmassscale
  29.      volscale = (cubemassatomscale / radicalvolscale) / radicalvolscale2
  30.      }
  31.      */
  32.    
  33. }
  34.  
  35. struct MantisNavigationView: View {
  36.     let formatter = NumberFormatter()
  37.     @StateObject var mantisgimbal = MantisGimbal()
  38.    
  39.    
  40.     @State var rofy = Double()//duration of Y cubed for locating point of gimbal
  41.     @State var npoint = Double()//navigation point
  42.     @State var durX = Double()//duration physic X axis
  43.     @State var durY = Double()//duration physic Y axis
  44.     @State var durXY = Double()//duration physic XY axis
  45.     @State var npointX = Double()//input
  46.     @State var npointY = Double()//input
  47.    
  48.     func rofy(rofyresult: Double) -> Double { cbrt(npoint) }
  49.     func durX(durXresult: Double) -> Double { cbrt(npointX) }
  50.     func durY(durYresult: Double) -> Double { cbrt(npointY) }
  51.     func durXY(durXYresult: Double) -> Double { pow(npointX + npointY, 2) }
  52.    
  53.     /*
  54.     let formatter: NumberFormatter = {
  55.         let formatter = NumberFormatter()
  56.         formatter.numberStyle = .scientific
  57.         formatter.positiveFormat = "0.###E+0"
  58.         formatter.exponentSymbol = "e"
  59.         return formatter
  60.     }()
  61.      */
  62.     var body: some View {
  63.         ScrollView([.horizontal, .vertical], showsIndicators: true) {
  64.             VStack(alignment: .center) {
  65.                
  66.                 Image("C2ES")
  67.                     .resizable()
  68.                     .aspectRatio(contentMode: .fit)
  69.                     .frame(maxWidth: 100, maxHeight: 100, alignment: .center)
  70.                
  71.                
  72.                     .padding(.bottom, 50)
  73.                 Text("Mantis Navigation Controller")
  74.                     .font(.callout)
  75.                     .bold()
  76.             }
  77.             Divider()
  78.             VStack(alignment: .leading) {
  79.                 Text("Duration Point X Axis:").font(.callout).bold()
  80.                 TextField("#", value: $mantisgimbal.npointX, formatter: formatter)
  81.                     .textFieldStyle(RoundedBorderTextFieldStyle())
  82.                     .overlay(RoundedRectangle(cornerRadius: 6).stroke(Color.blue, lineWidth: 2))
  83.                 Text("Duration Point Y Axis:").font(.callout).bold()
  84.                 TextField("#", value: $mantisgimbal.npointY, formatter: formatter)
  85.                     .textFieldStyle(RoundedBorderTextFieldStyle())
  86.                     .overlay(RoundedRectangle(cornerRadius: 6).stroke(Color.blue, lineWidth: 2))
  87.                 Divider().frame(width: 480)
  88.                // VStack(alignment: .leading) {
  89.                     Text("Mantis Duration Vector: \(mantisgimbal.durXY)").font(.callout).bold()
  90.                     //.frame(width: 500, height: 500, alignment: .topLeading)
  91.               //  }
  92.            // }.padding()
  93.                
  94.             }.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
  95.                 .shadow(radius: 12)
  96.            
  97.             /*
  98.             VStack(alignment: .center) {
  99.                
  100.                 Image("C2ES")
  101.                     .resizable()
  102.                     .aspectRatio(contentMode: .fit)
  103.                     .frame(maxWidth: 100, maxHeight: 100, alignment: .center)
  104.                
  105.                
  106.                     .padding(.bottom, 50)
  107.                 Text("Mantis Navigation Controller")
  108.                     .font(.callout)
  109.                     .bold()
  110.             }
  111.             Divider()
  112.             HStack(alignment: .center) {
  113.                
  114.                 //  HStack(alignment: .top) {
  115.                
  116.                 VStack(alignment: .leading) {
  117.                    
  118.                        
  119.                     Text("Root of Y:")
  120.                         .font(.callout)
  121.                         .bold()
  122.                     // .colorInvert()
  123.                     TextField("#", value: self.$npoint, formatter: formatter)
  124.                     //.colorInvert()
  125.                    
  126.                         .textFieldStyle(RoundedBorderTextFieldStyle())
  127.                         .overlay(
  128.                             RoundedRectangle(cornerRadius: 6)
  129.                                 .stroke(Color.blue, lineWidth: 2)
  130.                         )
  131.                    
  132.                     Text("Point of Gimbal XYZ: \(rofy(rofyresult: npoint))")
  133.                         .font(.callout)
  134.                         .bold()
  135.                         .frame(width: 450, height: 60, alignment: .leading)
  136.                    
  137.                    
  138.                    
  139.                 }.padding()
  140.                
  141.             }
  142.            */
  143.         } .background(Color.clear)
  144.         //.background(LinearGradient(gradient: Gradient(colors: [.brown, .black]), startPoint: .topTrailing, endPoint: .bottomLeading))
  145.     }
  146.    
  147.    
  148. }
  149.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement