Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import PlaygroundSupport
- import Foundation
- import SwiftUI
- import PDFKit
- import SceneKit
- import UniformTypeIdentifiers
- import SafariServices
- class MantisGimbal: ObservableObject {
- @Published var npointX: Double = 0.0 {
- didSet { MGimbal() }
- }
- @Published var npointY: Double = 0.0 {
- didSet { MGimbal() }
- }
- @Published var durXY: Double = 0.0
- func MGimbal() {
- let rofy = pow(npointX + npointY, 2)
- durXY = cbrt(rofy)
- }
- /*
- func updateVolscale() {
- let cubemassatomscale = (((2 / (cbrt(1 * 2))) + radicalmassscale) - 1) + radicalmassscale
- volscale = (cubemassatomscale / radicalvolscale) / radicalvolscale2
- }
- */
- }
- struct MantisNavigationView: View {
- let formatter = NumberFormatter()
- @StateObject var mantisgimbal = MantisGimbal()
- @State var rofy = Double()//duration of Y cubed for locating point of gimbal
- @State var npoint = Double()//navigation point
- @State var durX = Double()//duration physic X axis
- @State var durY = Double()//duration physic Y axis
- @State var durXY = Double()//duration physic XY axis
- @State var npointX = Double()//input
- @State var npointY = Double()//input
- func rofy(rofyresult: Double) -> Double { cbrt(npoint) }
- func durX(durXresult: Double) -> Double { cbrt(npointX) }
- func durY(durYresult: Double) -> Double { cbrt(npointY) }
- func durXY(durXYresult: Double) -> Double { pow(npointX + npointY, 2) }
- /*
- let formatter: NumberFormatter = {
- let formatter = NumberFormatter()
- formatter.numberStyle = .scientific
- formatter.positiveFormat = "0.###E+0"
- formatter.exponentSymbol = "e"
- return formatter
- }()
- */
- var body: some View {
- ScrollView([.horizontal, .vertical], showsIndicators: true) {
- VStack(alignment: .center) {
- Image("C2ES")
- .resizable()
- .aspectRatio(contentMode: .fit)
- .frame(maxWidth: 100, maxHeight: 100, alignment: .center)
- .padding(.bottom, 50)
- Text("Mantis Navigation Controller")
- .font(.callout)
- .bold()
- }
- Divider()
- VStack(alignment: .leading) {
- Text("Duration Point X Axis:").font(.callout).bold()
- TextField("#", value: $mantisgimbal.npointX, formatter: formatter)
- .textFieldStyle(RoundedBorderTextFieldStyle())
- .overlay(RoundedRectangle(cornerRadius: 6).stroke(Color.blue, lineWidth: 2))
- Text("Duration Point Y Axis:").font(.callout).bold()
- TextField("#", value: $mantisgimbal.npointY, formatter: formatter)
- .textFieldStyle(RoundedBorderTextFieldStyle())
- .overlay(RoundedRectangle(cornerRadius: 6).stroke(Color.blue, lineWidth: 2))
- Divider().frame(width: 480)
- // VStack(alignment: .leading) {
- Text("Mantis Duration Vector: \(mantisgimbal.durXY)").font(.callout).bold()
- //.frame(width: 500, height: 500, alignment: .topLeading)
- // }
- // }.padding()
- }.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
- .shadow(radius: 12)
- /*
- VStack(alignment: .center) {
- Image("C2ES")
- .resizable()
- .aspectRatio(contentMode: .fit)
- .frame(maxWidth: 100, maxHeight: 100, alignment: .center)
- .padding(.bottom, 50)
- Text("Mantis Navigation Controller")
- .font(.callout)
- .bold()
- }
- Divider()
- HStack(alignment: .center) {
- // HStack(alignment: .top) {
- VStack(alignment: .leading) {
- Text("Root of Y:")
- .font(.callout)
- .bold()
- // .colorInvert()
- TextField("#", value: self.$npoint, formatter: formatter)
- //.colorInvert()
- .textFieldStyle(RoundedBorderTextFieldStyle())
- .overlay(
- RoundedRectangle(cornerRadius: 6)
- .stroke(Color.blue, lineWidth: 2)
- )
- Text("Point of Gimbal XYZ: \(rofy(rofyresult: npoint))")
- .font(.callout)
- .bold()
- .frame(width: 450, height: 60, alignment: .leading)
- }.padding()
- }
- */
- } .background(Color.clear)
- //.background(LinearGradient(gradient: Gradient(colors: [.brown, .black]), startPoint: .topTrailing, endPoint: .bottomLeading))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement