-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeshInterpolate.py
37 lines (28 loc) · 932 Bytes
/
meshInterpolate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#meshInterpolate.py
#Description: interpolate point cloud to an STL mesh
#Engineer: T Looby
#Date: 20220420
import sys
import numpy as np
import pandas as pd
import sklearn
stlFile = '/home/tom/work/CFS/projects/ansysTest/ANSYSmesh843.stl'
pcFile = '/home/tom/work/CFS/projects/ansysTest/HF_optical.csv'
#HEAT path
HEATpath = '/home/tom/source/HEAT/github/source'
sys.path.append(HEATpath)
#load HEAT environment
import launchHEAT
launchHEAT.loadEnviron()
#load HEAT CAD module and STP file
import CADClass
CAD = CADClass.CAD(os.environ["rootDir"], os.environ["dataPath"])
#load STL
mesh = CAD.loadExternalSTL(stlFile)
#Now get face centers, normals, areas
norms, ctrs, areas = CAD.normsCentersAreas(mesh)
#load point cloud data
pc = pd.read_csv(pcFile, names=['X','Y','Z','Val'], skiprows=[0])
pcData = pc.values
gp = sklearn.gaussian_process.GaussianProcessRegressor(kernel=RBF(10, (1e-2, 1e2)))
gp.fit()