Success, (pending confirmation of surface created), at creating new surface point network, .csv, and importing the network of curve points back in to MoI interpcurve. MoI>Network>gSurface looks nice. Now to clean up the code...and get the project all together.
There are so many setting possibilities--myriad...
Sill need to apply MoI symmetry and mirror operations...
This python script runs in Python 3.9.1.
Input gDomain.CSV is in Desktop. Output gPatch.CSV is now also in the Desktop.
Plan on doing a denser input mesh of curves...
code:
#gNetP1.py, from gDomain.csv, create gNetP1.csv
import numpy as np
import pandas as pd
import csv
from mpmath import *
mp.dps = 25 #; mp.pretty = True
aScale = 1
#K = 1.68575035481259604287120365779
K = ellipk(0.25)
#Kp = 2.1565156474996432354386749988
Kp = ellipk(0.75)
Kpp = (K*K + Kp*Kp)
#theta = 0.6634829705114348080575689, Bonnet angle, radians, ~38.0147739891°
theta = acot(Kp/K)
kappa = aScale*mp.sqrt(Kpp)/(K*Kp) # normalization constant
EiTheta = complex(mp.cos(theta),mp.sin(theta))
sqrt2 = mp.sqrt(2)
twoSqrt2 = 2 * sqrt2
mod97 = (97+0.24484) - 56 * mp.sqrt(3)
zeta = 1/sqrt2
eta = aScale/4
# Import csv coordinate values and curveIndex
# MODIFY orcha to <username>, and use your gDomain.csv:
csvInPath = r"C:\Users\orcha\OneDrive\Desktop\gDomain.csv"
columns = ['xCol', 'yCol', 'zCol', 'cIndex'] #names of columns
dtypes = {'xCol': np.float64, 'yCol': np.float64, 'zCol': np.float64, 'cIndex': np.int64} #dictionary
gDomain_df = pd.read_csv(csvInPath, header=None, names=columns, dtype=dtypes)
# Setup output gNetP1.csv.
with open('C:\\Users\\orcha\\OneDrive\\Desktop\\gNetP1.csv', "w", newline="" ) as f:
writer = csv.writer(f)
for i in range(0, len(gDomain_df)):
x = gDomain_df.at[i, 'xCol']
y = gDomain_df.at[i, 'yCol']
cIdx = gDomain_df.at[i, 'cIndex']
w = complex(x, y)
ww = w * w
wwww = ww * ww
ww4 = ww * 4
numer1 = w * twoSqrt2
denom3 = wwww + 1
denom1 = mp.sqrt(denom3 + ww4)
quotientX = (numer1 / denom1)
quotientY = (((-1)*numer1) / denom1)
quotientZ = (ww4 / denom3)
as1 = asin(quotientX)
as2 = asin(quotientY)
as3 = asin(quotientZ)
myf1 = (ellipf(as1, 0.25))/twoSqrt2
myf2 = (ellipf(as2, 0.75))/twoSqrt2
myf3 = (ellipf(as3, mod97))/4
x1 = kappa*((EiTheta * myf1).real)
y1 = kappa*((EiTheta * myf2).imag)
z1 = kappa*((EiTheta * myf3).real)
X = float(nstr((-zeta*x1 - zeta*y1), 17, min_fixed=0, max_fixed=0))
Y = float(nstr((-zeta*x1 + zeta*y1 + 2*eta), 17, min_fixed=0, max_fixed=0))
Z = float(nstr((z1 + 3*eta), 17, min_fixed=0, max_fixed=0))
writer.writerow([X, Y, Z, cIdx])
- Brian
Revised 3/2/2021, uses Desktop for location of files.