11module StarTIN
22using Libdl
33using startin_jll
4+ # libstartin = joinpath(pwd(), "../startin/target/release/libstartin.dylib")
5+
46
57struct Star
68 pt:: Vector{Float64} # length 3
2931
3032
3133function Base. insert! (t:: DT , points:: Matrix{Float64} )
32- w, h = size (points)
34+ w, _ = size (points)
3335 w == 3 || error (" Point array should be 3 dimensional, got $w dimensions." )
3436 res = ccall ((:insert , libstartin), Cint, (Ptr{Triangulation}, Cint, Ref{Cdouble}), t. ptr, length (points), points)
3537 res == 0 || @warn " $res duplicate points encountered."
3638 res
3739end
3840
41+ function Base. insert! (t:: DT , point:: Vector{Float64} )
42+ w = length (point)
43+ w == 3 || error (" Point array should be 3 dimensional, got $w dimensions." )
44+ res = ccall ((:insert_one_pt , libstartin), Cint, (Ptr{Triangulation}, Cdouble, Cdouble, Cdouble), t. ptr, point[1 ], point[2 ], point[3 ])
45+ res == 0 || @warn " Error inserting point."
46+ res
47+ end
48+
49+ function Base. delete! (t:: DT , pointid)
50+ res = ccall ((:remove , libstartin), Cint, (Ptr{Triangulation}, Cint), t. ptr, pointid)
51+ res == 0 || @warn " $res duplicate points encountered."
52+ res
53+ end
54+
3955function info (t:: DT )
4056 ccall ((:debug , libstartin), Cint, (Ptr{Triangulation},), t. ptr)
4157end
4258
59+ function get_snap_tolerance (t:: DT )
60+ ccall ((:get_snap_tolerance , libstartin), Cdouble, (Ptr{Triangulation},), t. ptr)
61+ end
62+ function set_snap_tolerance! (t:: DT , tol:: Float64 )
63+ ccall ((:set_snap_tolerance , libstartin), Cdouble, (Ptr{Triangulation}, Cdouble), t. ptr, tol)
64+ end
65+
4366function interpolate_nn (t:: DT , x:: Float64 , y:: Float64 )
4467 ccall ((:interpolate_nn , libstartin), Cdouble, (Ptr{Triangulation}, Cdouble, Cdouble), t. ptr, x, y)
4568end
4669function interpolate_linear (t:: DT , x:: Float64 , y:: Float64 )
4770 ccall ((:interpolate_linear , libstartin), Cdouble, (Ptr{Triangulation}, Cdouble, Cdouble), t. ptr, x, y)
4871end
72+ function interpolate_nni (t:: DT , x:: Float64 , y:: Float64 )
73+ ccall ((:interpolate_nni , libstartin), Cdouble, (Ptr{Triangulation}, Cdouble, Cdouble), t. ptr, x, y)
74+ end
4975function interpolate_laplace (t:: DT , x:: Float64 , y:: Float64 )
5076 ccall ((:interpolate_laplace , libstartin), Cdouble, (Ptr{Triangulation}, Cdouble, Cdouble), t. ptr, x, y)
5177end
@@ -60,10 +86,12 @@ function destroy!(t::DT)
6086end
6187
6288export DT
63- export insert!
6489export interpolate_nn
90+ export interpolate_nni
6591export interpolate_linear
6692export interpolate_laplace
93+ export get_snap_tolerance
94+ export set_snap_tolerance!
6795export write!
6896export destroy!
6997export info
0 commit comments