Geom Surface Query Functions

This group of API functions pertains to general surface queries for Geom surfaces, such as computing 3D location from surface coordinates, identifying curvature, and performing point projections.

CompPnt01(geom_id, surf_indx, u, w)

Calculate the 3D coordinate equivalent for the input surface coordinate point

CompNorm01(geom_id, surf_indx, u, w)

Calculate the normal vector on the specified surface at input surface coordinate

CompTanU01(geom_id, surf_indx, u, w)

Calculate the vector tangent to the specified surface at input surface coordinate in the U direction

CompTanW01(geom_id, surf_indx, u, w)

Calculate the vector tangent to the specified surface at input surface coordinate in the W direction

CompCurvature01(geom_id, surf_indx, u, w)

Determine the curvature of a specified surface at the input surface coordinate point

ProjPnt01(geom_id, surf_indx, pt)

Determine the nearest surface coordinate for an input 3D coordinate point and calculate the distance between the 3D point and the closest point of the surface.

ProjPnt01I(geom_id, pt)

Determine the nearest surface coordinate and corresponding parent Geom main surface index for an input 3D coordinate point.

ProjPnt01Guess(geom_id, surf_indx, pt, u0, w0)

Determine the nearest surface coordinate for an input 3D coordinate point and calculate the distance between the 3D point and the closest point of the surface.

AxisProjPnt01(geom_id, surf_indx, iaxis, pt)

Project an input 3D coordinate point onto a surface along a specified axis.

AxisProjPnt01I(geom_id, iaxis, pt)

Project an input 3D coordinate point onto a Geom along a specified axis.

AxisProjPnt01Guess(geom_id, surf_indx, ...)

Project an input 3D coordinate point onto a surface along a specified axis given an initial guess of surface parameter.

InsideSurf(geom_id, surf_indx, pt)

Test whether a given point is inside a specified surface.

CompPntRST(geom_id, surf_indx, r, s, t)

Calculate the (X, Y, Z) coordinate for the input volume (R, S, T) coordinate point

FindRST(geom_id, surf_indx, pt)

Determine the nearest (R, S, T) volume coordinate for an input (X, Y, Z) 3D coordinate point and calculate the distance between the 3D point and the found volume point.

FindRSTGuess(geom_id, surf_indx, pt, r0, s0, t0)

Determine the nearest (R, S, T) volume coordinate for an input (X, Y, Z) 3D coordinate point given an initial guess of volume coordinates.

ConvertRSTtoLMN(geom_id, surf_indx, r, s, t)

Convert RST volumetric coordinates to LMN coordinates.

ConvertRtoL(geom_id, surf_indx, r)

Convert R volumetric coordinate to L coordinate.

ConvertLMNtoRST(geom_id, surf_indx, l, m, n)

Convert LMN volumetric coordinates to RST coordinates.

ConvertLtoR(geom_id, surf_indx, l)

Convert L volumetric coordinate to R coordinate.

ConvertUtoEta(geom_id, u)

Convert U coordinate to eta wing coordinate.

ConvertEtatoU(geom_id, eta)

Convert eta wing coordinate to u coordinate.

CompVecPnt01(geom_id, surf_indx, u_in_vec, ...)

Determine 3D coordinate for each surface coordinate point in the input arrays

CompVecDegenPnt01(geom_id, surf_indx, ...)

Determine 3D coordinate for each degen surface coordinate point in the input arrays

CompVecNorm01(geom_id, surf_indx, us, ws)

Determine the normal vector on a surface for each surface coordinate point in the input arrays

CompVecCurvature01(geom_id, surf_indx, us, ws)

Determine the curvature of a specified surface at each surface coordinate point in the input arrays

ProjVecPnt01(geom_id, surf_indx, pts)

Determine the nearest surface coordinates for an input array of 3D coordinate points and calculate the distance between each 3D point and the closest point of the surface.

ProjVecPnt01Guess(geom_id, surf_indx, pts, ...)

Determine the nearest surface coordinates for an input array of 3D coordinate points and calculate the distance between each 3D point and the closest point of the surface.

AxisProjVecPnt01(geom_id, surf_indx, iaxis, pts)

Project an input array of 3D coordinate points onto a surface along a specified axis.

AxisProjVecPnt01Guess(geom_id, surf_indx, ...)

Project an input array of 3D coordinate points onto a surface along a specified axis given initial guess arrays of surface parameter.

VecInsideSurf(geom_id, surf_indx, pts)

Test whether a vector of points are inside a specified surface.

CompVecPntRST(geom_id, surf_indx, r_in_vec, ...)

Determine 3D coordinate for each volume coordinate point in the input arrays

FindRSTVec(geom_id, surf_indx, pts)

Determine the nearest volume coordinates for an input array of 3D coordinate points and calculate the distance between each 3D point and the found point in the volume.

FindRSTVecGuess(geom_id, surf_indx, pts, ...)

Determine the nearest volume coordinates for an input array of 3D coordinate points and calculate the distance between each 3D point and the closest point of the volume.

ConvertRSTtoLMNVec(geom_id, surf_indx, ...)

Convert vector of RST volumetric coordinates to LMN coordinates.

ConvertLMNtoRSTVec(geom_id, surf_indx, ...)

Convert vector of LMN volumetric coordinates to RST coordinates.

GetUWTess01(geom_id, surf_indx)

Get the surface coordinate point of each intersection of the tessellated wireframe for a particular surface

Details

openvsp.CompPnt01(geom_id, surf_indx, u, w)[source]

Calculate the 3D coordinate equivalent for the input surface coordinate point

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890

pnt = CompPnt01( geom_id, surf_indx, u, w )

print( f"Point: ( {pnt.x()}, {pnt.y()}, {pnt.z()} )" )

# The point is on the surface, so projecting it back has to land on it and
# recover the coordinates it came from.
d, u_out, w_out = ProjPnt01( geom_id, surf_indx, pnt )

assert d < 1e-6, "CompPnt01 returned a point off the surface"
assert abs( u_out - u ) < 1e-6, "CompPnt01 does not round trip through ProjPnt01"
assert abs( w_out - w ) < 1e-6, "CompPnt01 does not round trip through ProjPnt01"

# W wraps around the section, so 0 and 1 are the same place.
assert dist( CompPnt01( geom_id, surf_indx, u, 0.0 ), CompPnt01( geom_id, surf_indx, u, 1.0 ) ) < 1e-6, "the surface does not close in W"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – u double U (0 - 1) surface coordinate

  • [in] – w double W (0 - 1) surface coordinate

Return type:

vec3d

Returns:

vec3d Normal vector3D coordinate point

openvsp.CompNorm01(geom_id, surf_indx, u, w)[source]

Calculate the normal vector on the specified surface at input surface coordinate

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890

norm = CompNorm01( geom_id, surf_indx, u, w )

assert abs( norm.mag() - 1.0 ) < 1e-9, "CompNorm01 is not a unit vector"

print( "Point: ( {norm.x()}, {norm.y()}, {norm.z()} )" )
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – u double U (0 - 1) surface coordinate

  • [in] – w double W (0 - 1) surface coordinate

Return type:

vec3d

Returns:

vec3d Normal vector

openvsp.CompTanU01(geom_id, surf_indx, u, w)[source]

Calculate the vector tangent to the specified surface at input surface coordinate in the U direction

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890

tanu = CompTanU01( geom_id, surf_indx, u, w )

assert tanu.mag() > 0.0, "CompTanU01 is degenerate"

print( f"Point: ( {tanu.x()}, {tanu.y()}, {tanu.z()} )" )
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – u double U (0 - 1) surface coordinate

  • [in] – w double W (0 - 1) surface coordinate

Return type:

vec3d

Returns:

vec3d Tangent vector in U direction

openvsp.CompTanW01(geom_id, surf_indx, u, w)[source]

Calculate the vector tangent to the specified surface at input surface coordinate in the W direction

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890

tanw = CompTanW01( geom_id, surf_indx, u, w )

assert tanw.mag() > 0.0, "CompTanW01 is degenerate"

print( f"Point: ( {tanw.x()}, {tanw.y()}, {tanw.z()} )" )
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – u double U (0 - 1) surface coordinate

  • [in] – w double W (0 - 1) surface coordinate

Return type:

vec3d

Returns:

vec3d Tangent vector in W direction

openvsp.CompCurvature01(geom_id, surf_indx, u, w)[source]

Determine the curvature of a specified surface at the input surface coordinate point

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0


u = 0.25
w = 0.75

k1, k2, ka, kg = CompCurvature01( geom_id, surf_indx, u, w )

print( f"Curvature : k1 {k1} k2 {k2} ka {ka} kg {kg}" )

# The mean curvature is the average of the principal curvatures, and the
# Gaussian curvature is their product.
assert abs( ka - 0.5 * ( k1 + k2 ) ) < 1e-9, "the mean curvature does not match the principal curvatures"
assert abs( kg - k1 * k2 ) < 1e-9, "the Gaussian curvature does not match the principal curvatures"

# A Pod is convex everywhere, so the Gaussian curvature is positive.
assert kg > 0.0, "a Pod should be convex here"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – u double U (0 - 1) surface coordinate

  • [in] – w double W (0 - 1) surface coordinate

  • [out] – k1_out double Output value of maximum principal curvature

  • [out] – k2_out double Output value of minimum principal curvature

  • [out] – ka_out double Output value of mean curvature

  • [out] – kg_out double Output value of Gaussian curvature

openvsp.ProjPnt01(geom_id, surf_indx, pt)[source]

Determine the nearest surface coordinate for an input 3D coordinate point and calculate the distance between the 3D point and the closest point of the surface.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890

pnt = CompPnt01( geom_id, surf_indx, u, w )

norm = CompNorm01( geom_id, surf_indx, u, w )


# Offset point from surface
pnt.set_xyz( pnt.x() + norm.x(), pnt.y() + norm.y(), pnt.z() + norm.z() )

d, uout, wout = ProjPnt01( geom_id, surf_indx, pnt )

# pnt sits one unit off the surface along its own normal, so the
# projection comes back to where it started at a distance of one.
assert abs( d - 1.0 ) < 1e-6, "ProjPnt01 distance"
assert abs( uout - u ) < 1e-6 and abs( wout - w ) < 1e-6, "ProjPnt01 u, w"

print( f"Dist {d} u {uout} w {wout}" )

See also: ProjPnt01Guess, ProjPnt01I :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pt vec3d Input 3D coordinate point :param [out]: u_out double Output closest U (0 - 1) surface coordinate :param [out]: w_out double Output closest W (0 - 1) surface coordinate :rtype: float :return: double Distance between the 3D point and the closest point of the surface

openvsp.ProjPnt01I(geom_id, pt)[source]

Determine the nearest surface coordinate and corresponding parent Geom main surface index for an input 3D coordinate point. Return the distance between the closest point and the input.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890

d = 0

pnt = CompPnt01( geom_id, surf_indx, u, w )

norm = CompNorm01( geom_id, surf_indx, u, w )



# Offset point from surface
pnt.set_xyz( pnt.x() + norm.x(), pnt.y() + norm.y(), pnt.z() + norm.z() )

d, surf_indx_out, uout, wout = ProjPnt01I( geom_id, pnt )

# pnt sits one unit off the surface along its own normal, so the
# projection comes back to where it started at a distance of one.
assert abs( d - 1.0 ) < 1e-6, "ProjPnt01I distance"
assert abs( uout - u ) < 1e-6 and abs( wout - w ) < 1e-6, "ProjPnt01I u, w"

print( f"Dist {d} u {uout} w {wout} surf_index {surf_indx_out}" )

See also: ProjPnt01, ProjPnt01Guess :param [in]: geom_id string Parent Geom ID :param [in]: pt vec3d Input 3D coordinate point :param [out]: surf_indx_out int Output main surface index from the parent Geom :param [out]: u_out double Output closest U (0 - 1) surface coordinat :param [out]: w_out double Output closest W (0 - 1) surface coordinat :rtype: float :return: double Distance between the 3D point and the closest point of the surface

openvsp.ProjPnt01Guess(geom_id, surf_indx, pt, u0, w0)[source]

Determine the nearest surface coordinate for an input 3D coordinate point and calculate the distance between the 3D point and the closest point of the surface. This function takes an input surface coordinate guess for, offering a potential decrease in computation time compared to ProjPnt01.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890

d = 0

pnt = CompPnt01( geom_id, surf_indx, u, w )

norm = CompNorm01( geom_id, surf_indx, u, w )


# Offset point from surface
pnt.set_xyz( pnt.x() + norm.x(), pnt.y() + norm.y(), pnt.z() + norm.z() )

d, uout, wout = ProjPnt01Guess( geom_id, surf_indx, pnt, u + 0.1, w + 0.1 )

# pnt sits one unit off the surface along its own normal, so the
# projection comes back to where it started at a distance of one.
assert abs( d - 1.0 ) < 1e-6, "ProjPnt01Guess distance"
assert abs( uout - u ) < 1e-6 and abs( wout - w ) < 1e-6, "ProjPnt01Guess u, w"

print( f"Dist {d} u {uout} w {wout}" )

See also: ProjPnt01, ProjPnt01I :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pt vec3d Input 3D coordinate point :param [in]: u0 double Input U (0 - 1) surface coordinate guess :param [in]: w0 double Input W (0 - 1) surface coordinate guess :param [out]: u_out double Output closest U (0 - 1) surface coordinate :param [out]: w_out double Output closest W (0 - 1) surface coordinate :rtype: float :return: double Distance between the 3D point and the closest point of the surface

openvsp.AxisProjPnt01(geom_id, surf_indx, iaxis, pt)[source]

Project an input 3D coordinate point onto a surface along a specified axis. If the axis-aligned ray from the point intersects the surface multiple times, the nearest intersection is returned. If the axis-aligned ray from the point does not intersect the surface, the original point is returned and -1 is returned in the other output parameters.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890

surf_pt = CompPnt01( geom_id, surf_indx, u, w )

# Assignment binds a reference in Python rather than copying as it does in
# AngelScript, so build a separate point instead of offsetting surf_pt.
pt = vec3d( surf_pt.x(), surf_pt.y(), surf_pt.z() )

pt.offset_y( -5.0 )

idist, u_out, w_out = AxisProjPnt01( geom_id, surf_indx, Y_DIR, pt )

# pt is the surface point pushed off in -Y, so projecting back along Y
# has to land on the point it came from.
p_out = CompPnt01( geom_id, surf_indx, u_out, w_out )
assert abs( surf_pt.x() - p_out.x() ) < 1e-6 and abs( surf_pt.y() - p_out.y() ) < 1e-6 and abs( surf_pt.z() - p_out.z() ) < 1e-6, "AxisProjPnt01 did not recover the original point"

print( f"iDist {idist} u_out {u_out} w_out {w_out}" )
print( "3D Offset ", False)

See also: AxisProjPnt01Guess, AxisProjPnt01I, AxisProjVecPnt01, AxisProjVecPnt01Guess :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: iaxis int Axis direction to project point along (X_DIR, Y_DIR, or Z_DIR) :param [in]: pt vec3d Input 3D coordinate point :param [out]: u_out double Output closest U (0 - 1) surface coordinate :param [out]: w_out double Output closest W (0 - 1) surface coordinate :rtype: float :return: double Axis aligned distance between the 3D point and the projected point on the surface

openvsp.AxisProjPnt01I(geom_id, iaxis, pt)[source]

Project an input 3D coordinate point onto a Geom along a specified axis. The intersecting surface index is also returned. If the axis-aligned ray from the point intersects the Geom multiple times, the nearest intersection is returned. If the axis-aligned ray from the point does not intersect the Geom, the original point is returned and -1 is returned in the other output parameters.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890

surf_pt = CompPnt01( geom_id, surf_indx, u, w )

# Assignment binds a reference in Python rather than copying as it does in
# AngelScript, so build a separate point instead of offsetting surf_pt.
pt = vec3d( surf_pt.x(), surf_pt.y(), surf_pt.z() )

pt.offset_y( -5.0 )


idist, surf_indx_out, u_out, w_out = AxisProjPnt01I( geom_id, Y_DIR, pt )

# pt is the surface point pushed off in -Y, so projecting back along Y
# has to land on the point it came from.
p_out = CompPnt01( geom_id, surf_indx, u_out, w_out )
assert abs( surf_pt.x() - p_out.x() ) < 1e-6 and abs( surf_pt.y() - p_out.y() ) < 1e-6 and abs( surf_pt.z() - p_out.z() ) < 1e-6, "AxisProjPnt01I did not recover the original point"

print( "iDist {idist} u_out {u_out} w_out {w_out} surf_index {surf_indx_out}" )
print( "3D Offset ", False)

See also: AxisProjPnt01, AxisProjPnt01Guess, AxisProjVecPnt01, AxisProjVecPnt01Guess :param [in]: geom_id string Parent Geom ID :param [in]: iaxis int Axis direction to project point along (X_DIR, Y_DIR, or Z_DIR) :param [in]: pt vec3d Input 3D coordinate point :param [out]: surf_indx_out int Output main surface index from the parent Geom :param [out]: u_out double Output closest U (0 - 1) surface coordinate :param [out]: w_out double Output closest W (0 - 1) surface coordinate :rtype: float :return: double Axis aligned distance between the 3D point and the projected point on the surface

openvsp.AxisProjPnt01Guess(geom_id, surf_indx, iaxis, pt, u0, w0)[source]

Project an input 3D coordinate point onto a surface along a specified axis given an initial guess of surface parameter. If the axis-aligned ray from the point intersects the surface multiple times, the nearest intersection is returned. If the axis-aligned ray from the point does not intersect the surface, the original point is returned and -1 is returned in the other output parameters. The surface parameter guess should allow this call to be faster than calling AxisProjPnt01 without a guess.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890



surf_pt = CompPnt01( geom_id, surf_indx, u, w )

# Assignment binds a reference in Python rather than copying as it does in
# AngelScript, so build a separate point instead of offsetting surf_pt.
pt = vec3d( surf_pt.x(), surf_pt.y(), surf_pt.z() )

pt.offset_y( -5.0 )

# Construct initial guesses near actual parameters
u0 = u + 0.01234
w0 = w - 0.05678

d, uout, wout = AxisProjPnt01Guess( geom_id, surf_indx, Y_DIR, pt, u0, w0 )

print( f"Dist {d} u {uout} w {wout}" )

# The test point sits five units away along Y from a known surface point, so
# projecting back along Y has to recover that point and that distance.
assert abs( uout - u ) < 1e-6, "AxisProjPnt01Guess did not recover the surface point"
assert abs( wout - w ) < 1e-6, "AxisProjPnt01Guess did not recover the surface point"
assert abs( d - 5.0 ) < 1e-6, "AxisProjPnt01Guess reported the wrong distance"

# Starting from a guess must not change the answer.
d_ng, uout_ng, wout_ng = AxisProjPnt01( geom_id, surf_indx, Y_DIR, pt )

assert abs( uout_ng - uout ) < 1e-6, "the guess changed the answer"
assert abs( wout_ng - wout ) < 1e-6, "the guess changed the answer"
assert abs( d_ng - d ) < 1e-6, "the guess changed the answer"

See also: AxisProjPnt01, AxisProjPnt01I, AxisProjVecPnt01, AxisProjVecPnt01Guess :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: iaxis int Axis direction to project point along (X_DIR, Y_DIR, or Z_DIR) :param [in]: pt vec3d Input 3D coordinate point :param [in]: u0 double Input U (0 - 1) surface coordinate guess :param [in]: w0 double Input W (0 - 1) surface coordinate guess :param [out]: u_out double Output closest U (0 - 1) surface coordinate :param [out]: w_out double Output closest W (0 - 1) surface coordinate :rtype: float :return: double Distance between the 3D point and the closest point of the surface

openvsp.InsideSurf(geom_id, surf_indx, pt)[source]

Test whether a given point is inside a specified surface.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

r = 0.12
s = 0.68
t = 0.56

pnt = CompPntRST( geom_id, surf_indx, r, s, t )

res = InsideSurf( geom_id, surf_indx, pnt )

# pnt was built by CompPntRST at r = 0.12, which is inside the surface.
assert res, "InsideSurf says an interior point is outside"

if  res :
    print( "Inside" )
else:
    print( "Outside" )

See also: VecInsideSurf :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pt vec3d Input 3D coordinate point :rtype: boolean :return: bool Boolean true if the point is inside the surface, false otherwise.

openvsp.CompPntRST(geom_id, surf_indx, r, s, t)[source]

Calculate the (X, Y, Z) coordinate for the input volume (R, S, T) coordinate point

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

r = 0.12
s = 0.68
t = 0.56

pnt = CompPntRST( geom_id, surf_indx, r, s, t )

print( f"Point: ( {pnt.x()}, {pnt.y()}, {pnt.z()} )" )

# T runs from the interior out to the skin, so t = 1 lands on the surface and
# anything short of that lands inside it.
d, u_out, w_out = ProjPnt01( geom_id, surf_indx, CompPntRST( geom_id, surf_indx, r, s, 1.0 ) )

assert d < 1e-6, "CompPntRST at t = 1 is not on the surface"
assert InsideSurf( geom_id, surf_indx, pnt ), "CompPntRST at t < 1 is not inside the surface"

# The point has to round trip back through the coordinates it came from.
d_rst, r_out, s_out, t_out = FindRST( geom_id, surf_indx, pnt )

assert dist( CompPntRST( geom_id, surf_indx, r_out, s_out, t_out ), pnt ) < 1e-6, "CompPntRST does not round trip through FindRST"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – r double R (0 - 1) volume coordinate

  • [in] – s double S (0 - 1) volume coordinate

  • [in] – t double T (0 - 1) volume coordinate

Return type:

vec3d

Returns:

vec3d coordinate point

openvsp.FindRST(geom_id, surf_indx, pt)[source]

Determine the nearest (R, S, T) volume coordinate for an input (X, Y, Z) 3D coordinate point and calculate the distance between the 3D point and the found volume point.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

r = 0.12
s = 0.68
t = 0.56

pnt = CompPntRST( geom_id, surf_indx, r, s, t )


d, rout, sout, tout = FindRST( geom_id, surf_indx, pnt )

print( f"Dist {d} r {rout} s {sout} t {tout}" )

# pnt came from CompPntRST at r, s, t, so the search has to land back on it.
assert abs( d ) < 1e-6, "FindRST distance"
assert abs( rout - r ) < 1e-6 and abs( sout - s ) < 1e-6 and abs( tout - t ) < 1e-6, "FindRST r, s, t"

See also: FindRSTGuess :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pt vec3d Input 3D coordinate point :param [out]: r_out double Output closest R (0 - 1.0) volume coordinate :param [out]: s_out double Output closest S (0 - 1.0) volume coordinate :param [out]: t_out double Output closest T (0 - 1.0) volume coordinate :rtype: float :return: double Distance between the 3D point and the closest point of the volume

openvsp.FindRSTGuess(geom_id, surf_indx, pt, r0, s0, t0)[source]

Determine the nearest (R, S, T) volume coordinate for an input (X, Y, Z) 3D coordinate point given an initial guess of volume coordinates. Also calculate the distance between the 3D point and the found volume point.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

r = 0.12
s = 0.68
t = 0.56

pnt = CompPntRST( geom_id, surf_indx, r, s, t )


r0 = 0.1
s0 = 0.6
t0 = 0.5

d, rout, sout, tout = FindRSTGuess( geom_id, surf_indx, pnt, r0, s0, t0 )

print( f"Dist {d} r {rout} s {sout} t {tout}" )

# pnt came from CompPntRST at r, s, t, so the search has to land back on it.
assert abs( d ) < 1e-6, "FindRSTGuess distance"
assert abs( rout - r ) < 1e-6 and abs( sout - s ) < 1e-6 and abs( tout - t ) < 1e-6, "FindRSTGuess r, s, t"

See also: FindRST :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pt vec3d Input 3D coordinate point :param [in]: r0 double Input R (0 - 1.0) volume coordinate guess :param [in]: s0 double Input S (0 - 1.0) volume coordinate guess :param [in]: t0 double Input T (0 - 1.0) volume coordinate guess :param [out]: r_out double Output closest R (0 - 1.0) volume coordinate :param [out]: s_out double Output closest S (0 - 1.0) volume coordinate :param [out]: t_out double Output closest T (0 - 1.0) volume coordinate :rtype: float :return: double Distance between the 3D point and the closest point of the volume

openvsp.ConvertRSTtoLMN(geom_id, surf_indx, r, s, t)[source]

Convert RST volumetric coordinates to LMN coordinates.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

r = 0.12
s = 0.68
t = 0.56

l_out, m_out, n_out = ConvertRSTtoLMN( geom_id, surf_indx, r, s, t )

# Converting back has to return the coordinates we started from.
r_back, s_back, t_back = ConvertLMNtoRST( geom_id, surf_indx, l_out, m_out, n_out )

assert abs( r_back - r ) < 1e-6 and abs( s_back - s ) < 1e-6 and abs( t_back - t ) < 1e-6, "ConvertRSTtoLMN does not round trip"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – r double R (0 - 1) volume coordinate

  • [in] – s double S (0 - 1) volume coordinate

  • [in] – t double T (0 - 1) volume coordinate

  • [out] – l_out double L (0 - 1) linear volume coordinate

  • [out] – m_out double M (0 - 1) linear volume coordinate

  • [out] – n_out double N (0 - 1) linear volume coordinate

openvsp.ConvertRtoL(geom_id, surf_indx, r)[source]

Convert R volumetric coordinate to L coordinate.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

r = 0.12

l_out = ConvertRtoL( geom_id, surf_indx, r )

# Converting back has to return the coordinate we started from.
r_back = ConvertLtoR( geom_id, surf_indx, l_out )

assert abs( r_back - r ) < 1e-6, "ConvertRtoL does not round trip"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – r double R (0 - 1) volume coordinate

  • [out] – l_out double L (0 - 1) linear volume coordinate

openvsp.ConvertLMNtoRST(geom_id, surf_indx, l, m, n)[source]

Convert LMN volumetric coordinates to RST coordinates.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

l = 0.12
m = 0.34
n = 0.56

r_out, s_out, t_out = ConvertLMNtoRST( geom_id, surf_indx, l, m, n )

# The conversion is invertible, so going back has to return the input.
l_out, m_out, n_out = ConvertRSTtoLMN( geom_id, surf_indx, r_out, s_out, t_out )

assert abs( l_out - l ) < 1e-6, "ConvertLMNtoRST does not invert"
assert abs( m_out - m ) < 1e-6, "ConvertLMNtoRST does not invert"
assert abs( n_out - n ) < 1e-6, "ConvertLMNtoRST does not invert"

# Both coordinate systems run over the unit cube.
assert 0.0 <= r_out <= 1.0, "ConvertLMNtoRST left the unit cube"
assert 0.0 <= s_out <= 1.0, "ConvertLMNtoRST left the unit cube"
assert 0.0 <= t_out <= 1.0, "ConvertLMNtoRST left the unit cube"

# The coordinates name a point in the volume, so evaluating them has to land
# inside the surface.
assert InsideSurf( geom_id, surf_indx, CompPntRST( geom_id, surf_indx, r_out, s_out, t_out ) ), "ConvertLMNtoRST did not name a point in the volume"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – l double L (0 - 1) linear volume coordinate

  • [in] – m double M (0 - 1) linear volume coordinate

  • [in] – n double N (0 - 1) linear volume coordinate

  • [out] – r_out double R (0 - 1) volume coordinate

  • [out] – s_out double S (0 - 1) volume coordinate

  • [out] – t_out double T (0 - 1) volume coordinate

openvsp.ConvertLtoR(geom_id, surf_indx, l)[source]

Convert L volumetric coordinate to R coordinate.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

l = 0.12

r_out = ConvertLtoR( geom_id, surf_indx, l )

# The conversion is invertible, so going back has to return the input.
l_out = ConvertRtoL( geom_id, surf_indx, r_out )

assert abs( l_out - l ) < 1e-6, "ConvertLtoR does not invert"
assert 0.0 <= r_out <= 1.0, "ConvertLtoR left the unit interval"

# Both coordinates run nose to tail, so the mapping is increasing.
r_more = ConvertLtoR( geom_id, surf_indx, l + 0.1 )

assert r_more > r_out, "ConvertLtoR is not increasing"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – l double L (0 - 1) volume coordinate

  • [out] – r_out double R (0 - 1) linear volume coordinate

openvsp.ConvertUtoEta(geom_id, u)[source]

Convert U coordinate to eta wing coordinate.

# Add Wing Geom
geom_id = AddGeom( "WING", "" )

surf_indx = 0

# U runs from 1 to N+1 over an N section wing when the root end cap is on,
# so a U below 1 sits in the cap and does not map to a span station.
u = 1.25

eta_out = ConvertUtoEta( geom_id, u )

# Converting back has to return the coordinate we started from.
u_back = ConvertEtatoU( geom_id, eta_out )

assert abs( u_back - u ) < 1e-6, "ConvertUtoEta does not round trip"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – u double U (0 - 1) surface coordinate

  • [out] – eta_out double Eta (0 - 1) wing spanwise coordinate

openvsp.ConvertEtatoU(geom_id, eta)[source]

Convert eta wing coordinate to u coordinate.

# Add Wing Geom
geom_id = AddGeom( "WING", "" )

surf_indx = 0

eta= 0.25

u = ConvertEtatoU( geom_id, eta )

# Converting back has to return the coordinate we started from.
eta_back = ConvertUtoEta( geom_id, u )

assert abs( eta_back - eta ) < 1e-6, "ConvertEtatoU does not round trip"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – eta double Eta (0 - 1) wing spanwise coordinate

  • [out] – u_out double U (0 - 1) surface coordinate

openvsp.CompVecPnt01(geom_id, surf_indx, u_in_vec, w_in_vec)[source]

Determine 3D coordinate for each surface coordinate point in the input arrays

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

uvec = [0]*n
wvec = [0]*n

for i in range(n):

    uvec[i] = (i+1)*1.0/(n+1)

    wvec[i] = (n-i)*1.0/(n+1)

ptvec = CompVecPnt01( geom_id, 0, uvec, wvec )

# One point per coordinate pair, each the same point the scalar form gives.
assert len( ptvec ) == n, "CompVecPnt01 returned the wrong number of points"

for i in range(n):
    assert dist( ptvec[i], CompPnt01( geom_id, 0, uvec[i], wvec[i] ) ) < 1e-9, "CompVecPnt01 disagrees with CompPnt01 at " + str( i )
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – u_in_vec vector<double> Input vector of U (0 - 1) surface coordinates

  • [in] – w_in_vec vector<double> Input vector of W (0 - 1) surface coordinates

Return type:

std::vector< vec3d,std::allocator< vec3d > >

Returns:

vector<vec3d> Vector of 3D coordinate points

openvsp.CompVecDegenPnt01(geom_id, surf_indx, degen_type, u_in_vec, w_in_vec)[source]

Determine 3D coordinate for each degen surface coordinate point in the input arrays

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

uvec = [0]*n
wvec = [0]*n

for i in range(n):

    uvec[i] = (i+1)*1.0/(n+1)

    wvec[i] = (n-i)*1.0/(n+1)

ptvec = CompVecDegenPnt01( geom_id, 0, 0, uvec, wvec )

# One point per coordinate pair.  Degen type 0 is the surface itself, so
# those points are the ones the surface form gives.
assert len( ptvec ) == n, "CompVecDegenPnt01 returned the wrong number of points"

surfvec = CompVecPnt01( geom_id, 0, uvec, wvec )

for i in range(n):
    assert dist( ptvec[i], surfvec[i] ) < 1e-6, "the degen surface does not follow the surface at " + str( i )
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – degen_type int Type of degen surface (0-S, 1-V, 2-H, 3-C)

  • [in] – u_in_vec vector<double> Input vector of U (0 - 1) surface coordinates

  • [in] – w_in_vec vector<double> Input vector of W (0 - 1) surface coordinates

Return type:

std::vector< vec3d,std::allocator< vec3d > >

Returns:

vector<vec3d> Vector of 3D coordinate points

openvsp.CompVecNorm01(geom_id, surf_indx, us, ws)[source]

Determine the normal vector on a surface for each surface coordinate point in the input arrays

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

uvec = [0]*n
wvec = [0]*n

for i in range(n):

    uvec[i] = (i+1)*1.0/(n+1)

    wvec[i] = (n-i)*1.0/(n+1)

normvec = CompVecNorm01( geom_id, 0, uvec, wvec )

for i in range( len( normvec ) ):
    assert abs( normvec[i].mag() - 1.0 ) < 1e-9, "CompVecNorm01 is not a unit vector"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – us vector<double> Input vector of U (0 - 1) surface coordinates

  • [in] – ws vector<double> Input vector of W (0 - 1) surface coordinates

Return type:

std::vector< vec3d,std::allocator< vec3d > >

Returns:

vector<vec3d> Vector of 3D normal vectors

openvsp.CompVecCurvature01(geom_id, surf_indx, us, ws)[source]

Determine the curvature of a specified surface at each surface coordinate point in the input arrays

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

uvec = [0]*n
wvec = [0]*n

for i in range(n):

    uvec[i] = (i+1)*1.0/(n+1)

    wvec[i] = (n-i)*1.0/(n+1)



k1vec, k2vec, kavec, kgvec = CompVecCurvature01( geom_id, 0, uvec, wvec )

# One value per coordinate pair, matching what the scalar form gives, and
# holding the same relationships between the four curvatures.
assert len( k1vec ) == n, "CompVecCurvature01 returned the wrong number of values"
assert len( k2vec ) == n, "CompVecCurvature01 returned the wrong number of values"
assert len( kavec ) == n, "CompVecCurvature01 returned the wrong number of values"
assert len( kgvec ) == n, "CompVecCurvature01 returned the wrong number of values"

for i in range(n):
    k1, k2, ka, kg = CompCurvature01( geom_id, 0, uvec[i], wvec[i] )

    assert abs( k1vec[i] - k1 ) < 1e-9, "CompVecCurvature01 disagrees with CompCurvature01 at " + str( i )
    assert abs( k2vec[i] - k2 ) < 1e-9, "CompVecCurvature01 disagrees with CompCurvature01 at " + str( i )
    assert abs( kavec[i] - ka ) < 1e-9, "CompVecCurvature01 disagrees with CompCurvature01 at " + str( i )
    assert abs( kgvec[i] - kg ) < 1e-9, "CompVecCurvature01 disagrees with CompCurvature01 at " + str( i )

    assert abs( kavec[i] - 0.5 * ( k1vec[i] + k2vec[i] ) ) < 1e-9, "the curvatures are inconsistent at " + str( i )
    assert abs( kgvec[i] - k1vec[i] * k2vec[i] ) < 1e-9, "the curvatures are inconsistent at " + str( i )
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – us vector<double> Input vector of U (0 - 1) surface coordinates

  • [in] – ws vector<double> Input vector of W (0 - 1) surface coordinates

  • [out] – k1_out_vec vector<double> Output vector of maximum principal curvatures

  • [out] – k2_out_vec vector<double> Output vector of minimum principal curvatures

  • [out] – ka_out_vec vector<double> Output vector of mean curvatures

  • [out] – kg_out_vec vector<double> Output vector of Gaussian curvatures

openvsp.ProjVecPnt01(geom_id, surf_indx, pts)[source]

Determine the nearest surface coordinates for an input array of 3D coordinate points and calculate the distance between each 3D point and the closest point of the surface.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

uvec = [0]*n
wvec = [0]*n

for i in range(n):

    uvec[i] = (i+1)*1.0/(n+1)

    wvec[i] = (n-i)*1.0/(n+1)

ptvec = CompVecPnt01( geom_id, 0, uvec, wvec )

normvec = CompVecNorm01( geom_id, 0, uvec, wvec )

for i in range(n):

    ptvec[i].set_xyz( ptvec[i].x() + normvec[i].x(), ptvec[i].y() + normvec[i].y(), ptvec[i].z() + normvec[i].z() )

uoutv, woutv, doutv = ProjVecPnt01( geom_id, 0, ptvec )

See also: ProjVecPnt01Guess :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pts vector<vec3d> Input vector of 3D coordinate points :param [out]: u_out_vec vector<double> Output vector of the closest U (0 - 1) surface coordinate for each 3D input point :param [out]: w_out_vec vector<double> Output vector of the closest W (0 - 1) surface coordinate for each 3D input point :param [out]: d_out_vec vector<double> Output vector of distances for each 3D point and the closest point of the surface

openvsp.ProjVecPnt01Guess(geom_id, surf_indx, pts, u0s, w0s)[source]

Determine the nearest surface coordinates for an input array of 3D coordinate points and calculate the distance between each 3D point and the closest point of the surface. This function takes an input array of surface coordinate guesses for each 3D coordinate, offering a potential decrease in computation time compared to ProjVecPnt01.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

uvec = [0]*n
wvec = [0]*n

for i in range(n):

    uvec[i] = (i+1)*1.0/(n+1)

    wvec[i] = (n-i)*1.0/(n+1)

ptvec = CompVecPnt01( geom_id, 0, uvec, wvec )

normvec = CompVecNorm01( geom_id, 0, uvec, wvec )

for i in range(n):

    ptvec[i].set_xyz( ptvec[i].x() + normvec[i].x(), ptvec[i].y() + normvec[i].y(), ptvec[i].z() + normvec[i].z() )

u0v = [0]*n
w0v = [0]*n

for i in range(n):

    u0v[i] = uvec[i] + 0.01234

    w0v[i] = wvec[i] - 0.05678

uoutv, woutv, doutv = ProjVecPnt01Guess( geom_id, 0, ptvec, u0v,  w0v )

# Each point was pushed one unit along its own normal, so each projects back
# to where it came from at a distance of one.  Starting from a guess must not
# change that.
uv_ng, wv_ng, dv_ng = ProjVecPnt01( geom_id, 0, ptvec )

for i in range(n):
    assert abs( doutv[i] - 1.0 ) < 1e-6, "ProjVecPnt01Guess did not recover point " + str( i )
    assert abs( uoutv[i] - uvec[i] ) < 1e-6, "ProjVecPnt01Guess did not recover point " + str( i )
    assert abs( woutv[i] - wvec[i] ) < 1e-6, "ProjVecPnt01Guess did not recover point " + str( i )

    assert abs( uoutv[i] - uv_ng[i] ) < 1e-6, "the guess changed the answer at " + str( i )
    assert abs( woutv[i] - wv_ng[i] ) < 1e-6, "the guess changed the answer at " + str( i )
    assert abs( doutv[i] - dv_ng[i] ) < 1e-6, "the guess changed the answer at " + str( i )

See also: ProjVecPnt01, :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pts vector<vec3d> Input vector of 3D coordinate points :param [in]: u0s vector<double> Input vector of U (0 - 1) surface coordinate guesses :param [in]: w0s vector<double> Input vector of W (0 - 1) surface coordinate guesses :param [out]: u_out_vec vector<double> Output vector of the closest U (0 - 1) surface coordinate for each 3D input point :param [out]: w_out_vec vector<double> Output vector of the closest W (0 - 1) surface coordinate for each 3D input point :param [out]: d_out_vec vector<double> Output array of distances for each 3D point and the closest point of the surface

openvsp.AxisProjVecPnt01(geom_id, surf_indx, iaxis, pts)[source]

Project an input array of 3D coordinate points onto a surface along a specified axis. If the axis-aligned ray from the point intersects the surface multiple times, the nearest intersection is returned. If the axis-aligned ray from the point does not intersect the surface, the original point is returned and -1 is returned in the other output parameters.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )
surf_indx = 0

n = 5

uvec = [0]*n
wvec = [0]*n

for i in range(n):

    uvec[i] = (i+1)*1.0/(n+1)

    wvec[i] = (n-i)*1.0/(n+1)

ptvec = CompVecPnt01( geom_id, surf_indx, uvec, wvec )

for i in range(n):

    ptvec[i].offset_y( -5.0 )

uoutv, woutv, doutv = AxisProjVecPnt01( geom_id, surf_indx, Y_DIR, ptvec )

# Some of these outputs are expected to be non-zero because the projected point is on the opposite side of
# the pod from the originally computed point.  I.e. there were multiple solutions and the original point
# is not the closest intersection point.  We could offset those points in the +Y direction instead of -Y.
for i in range(n):

    print( i, False )
    print( "U delta ", False )
    print( uvec[i] - uoutv[i], False )
    print( "W delta ", False )
    print( wvec[i] - woutv[i] )

# Whichever intersection was found, it has to be a real one: the reported
# coordinates have to name a point on the surface, and that point has to sit
# on the same Y ray the test point was offset along.
for i in range(n):

    assert uoutv[i] >= 0.0 and woutv[i] >= 0.0, "no intersection was found for point " + str( i )

    hit = CompPnt01( geom_id, surf_indx, uoutv[i], woutv[i] )

    assert abs( hit.x() - ptvec[i].x() ) < 1e-6, "the intersection left the Y ray at point " + str( i )
    assert abs( hit.z() - ptvec[i].z() ) < 1e-6, "the intersection left the Y ray at point " + str( i )
    assert abs( doutv[i] - abs( hit.y() - ptvec[i].y() ) ) < 1e-6, "the wrong distance was reported at point " + str( i )

See also: AxisProjPnt01, AxisProjPnt01Guess, AxisProjPnt01I, AxisProjVecPnt01Guess :param [in]: geom_id string Geom ID :param [in]: surf_indx int Main surface index from the Geom :param [in]: iaxis int Axis direction to project point along (X_DIR, Y_DIR, or Z_DIR) :param [in]: pts vector<vec3d> Input vector of 3D coordinate points :param [out]: u_out_vec vector<double> Output vector of the closest U (0 - 1) surface coordinate for each 3D input point :param [out]: w_out_vec vector<double> Output vector of the closest W (0 - 1) surface coordinate for each 3D input point :param [out]: d_out_vec vector<double> Output vector of axis distances for each 3D point and the projected point of the surface

openvsp.AxisProjVecPnt01Guess(geom_id, surf_indx, iaxis, pts, u0s, w0s)[source]

Project an input array of 3D coordinate points onto a surface along a specified axis given initial guess arrays of surface parameter. If the axis-aligned ray from the point intersects the surface multiple times, the nearest intersection is returned. If the axis-aligned ray from the point does not intersect the surface, the original point is returned and -1 is returned in the other output parameters. The surface parameter guess should allow this call to be faster than calling AxisProjVecPnt01 without a guess.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )
surf_indx = 0

n = 5

uvec = [0]*n
wvec = [0]*n

for i in range(n):

    uvec[i] = (i+1)*1.0/(n+1)

    wvec[i] = (n-i)*1.0/(n+1)

ptvec = CompVecPnt01( geom_id, surf_indx, uvec, wvec )

for i in range(n):

    ptvec[i].offset_y( -5.0 )

u0v = [0]*n
w0v = [0]*n

for i in range(n):

    u0v[i] = uvec[i] + 0.01234
    w0v[i] = wvec[i] - 0.05678

uoutv, woutv, doutv = AxisProjVecPnt01Guess( geom_id, surf_indx, Y_DIR, ptvec, u0v,  w0v )

for i in range(n):

    print( i, False )
    print( "U delta ", False )
    print( uvec[i] - uoutv[i], False )
    print( "W delta ", False )
    print( wvec[i] - woutv[i] )

# Whichever intersection was found, it has to be a real one: the reported
# coordinates have to name a point on the surface, and that point has to sit
# on the same Y ray the test point was offset along.
for i in range(n):

    assert uoutv[i] >= 0.0 and woutv[i] >= 0.0, "no intersection was found for point " + str( i )

    hit = CompPnt01( geom_id, surf_indx, uoutv[i], woutv[i] )

    assert abs( hit.x() - ptvec[i].x() ) < 1e-6, "the intersection left the Y ray at point " + str( i )
    assert abs( hit.z() - ptvec[i].z() ) < 1e-6, "the intersection left the Y ray at point " + str( i )
    assert abs( doutv[i] - abs( hit.y() - ptvec[i].y() ) ) < 1e-6, "the wrong distance was reported at point " + str( i )

See also: AxisProjPnt01, AxisProjPnt01Guess, AxisProjPnt01I, AxisProjVecPnt01 :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: iaxis int Axis direction to project point along (X_DIR, Y_DIR, or Z_DIR) :param [in]: pts vector<vec3d> Input vector of 3D coordinate points :param [in]: u0s vector<double> Input vector of U (0 - 1) surface coordinate guesses :param [in]: w0s vector<double> Input vector of W (0 - 1) surface coordinate guesses :param [out]: u_out_vec vector<double> Output vector of the closest U (0 - 1) surface coordinate for each 3D input point :param [out]: w_out_vec vector<double> Output vector of the closest W (0 - 1) surface coordinate for each 3D input point :param [out]: d_out_vec vector<double> Output vector of axis distances for each 3D point and the projected point of the surface

openvsp.VecInsideSurf(geom_id, surf_indx, pts)[source]

Test whether a vector of points are inside a specified surface.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

n = 5

rvec = [0]*n
svec = [0]*n
tvec = [0]*n

for i in range(n):

    rvec[i] = (i+1)*1.0/(n+1)

    svec[i] = (n-i)*1.0/(n+1)

    tvec[i] = (i+1)*1.0/(n+1)

ptvec = CompVecPntRST( geom_id, 0, rvec, svec, tvec )


res = VecInsideSurf( geom_id, surf_indx, ptvec )

# Every point came from CompVecPntRST with r below one, so all are inside.
for i in range( len( res ) ):
    assert res[i], "VecInsideSurf says an interior point is outside"

See also: VecInsideSurf :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pts vector<vec3d> Input vector of 3D coordinate points :rtype: std::vector< bool,std::allocator< bool > > :return: vector <bool> Boolean vector for each point. True if it is inside the surface, false otherwise.

openvsp.CompVecPntRST(geom_id, surf_indx, r_in_vec, s_in_vec, t_in_vec)[source]

Determine 3D coordinate for each volume coordinate point in the input arrays

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

rvec = [0]*n
svec = [0]*n
tvec = [0]*n

for i in range(n):

    rvec[i] = (i+1)*1.0/(n+1)

    svec[i] = (n-i)*1.0/(n+1)

    tvec[i] = (i+1)*1.0/(n+1)

ptvec = CompVecPntRST( geom_id, 0, rvec, svec, tvec )

# One point per coordinate triple, each the same point the scalar form
# gives, and every one of them inside the surface.
assert len( ptvec ) == n, "CompVecPntRST returned the wrong number of points"

for i in range(n):
    assert dist( ptvec[i], CompPntRST( geom_id, 0, rvec[i], svec[i], tvec[i] ) ) < 1e-9, "CompVecPntRST disagrees with CompPntRST at " + str( i )
    assert InsideSurf( geom_id, 0, ptvec[i] ), "CompVecPntRST returned a point outside the surface at " + str( i )
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – r_in_vec vector<double> Input vector of R (0 - 1.0) volume coordinates

  • [in] – s_in_vec vector<double> Input vector of S (0 - 1.0) volume coordinates

  • [in] – t_in_vec vector<double> Input vector of T (0 - 1.0) volume coordinates

Return type:

std::vector< vec3d,std::allocator< vec3d > >

Returns:

vector<vec3d> Vector of 3D coordinate points

openvsp.FindRSTVec(geom_id, surf_indx, pts)[source]

Determine the nearest volume coordinates for an input array of 3D coordinate points and calculate the distance between each 3D point and the found point in the volume.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

rvec = [0]*n
svec = [0]*n
tvec = [0]*n

for i in range(n):

    rvec[i] = (i+1)*1.0/(n+1)

    svec[i] = (n-i)*1.0/(n+1)

    tvec[i] = (i+1)*1.0/(n+1)

ptvec = CompVecPntRST( geom_id, 0, rvec, svec, tvec )



routv, soutv, toutv, doutv = FindRSTVec( geom_id, 0, ptvec )

# Every point came from CompVecPntRST, so each search lands back on its own.
for i in range( n ):
    assert abs( doutv[i] ) < 1e-6, "FindRSTVec distance"
    assert abs( routv[i] - rvec[i] ) < 1e-6, "FindRSTVec r"
    assert abs( soutv[i] - svec[i] ) < 1e-6, "FindRSTVec s"
    assert abs( toutv[i] - tvec[i] ) < 1e-6, "FindRSTVec t"

See also: FindRSTVecGuess :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pts vector<vec3d> Input vector of 3D coordinate points :param [out]: r_out_vec vector<double> Output vector of the closest R (0 - 1.0) volume coordinate for each 3D input point :param [out]: s_out_vec vector<double> Output vector of the closest S (0 - 1.0) volume coordinate for each 3D input point :param [out]: t_out_vec vector<double> Output vector of the closest T (0 - 1.0) volume coordinate for each 3D input point :param [out]: d_out_vec vector<double> Output vector of distances for each 3D point and the closest point of the volume

openvsp.FindRSTVecGuess(geom_id, surf_indx, pts, r0s, s0s, t0s)[source]

Determine the nearest volume coordinates for an input array of 3D coordinate points and calculate the distance between each 3D point and the closest point of the volume. This function takes an input array of volume coordinate guesses for each 3D coordinate, offering a potential decrease in computation time compared to FindRSTVec.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

rvec = [0]*n
svec = [0]*n
tvec = [0]*n

for i in range(n):

    rvec[i] = (i+1)*1.0/(n+1)

    svec[i] = (n-i)*1.0/(n+1)

    tvec[i] = (i+1)*1.0/(n+1)

ptvec = CompVecPntRST( geom_id, 0, rvec, svec, tvec )

for i in range(n):

    ptvec[i].set_xyz(ptvec[i].x() * 0.9, ptvec[i].y() * 0.9, ptvec[i].z() * 0.9)

routv, soutv, toutv, doutv = FindRSTVecGuess( geom_id, 0, ptvec, rvec, svec, tvec )

# The points above were scaled off the surface on purpose, so the search
# does not return to the original r, s, t.  What must hold is that every
# point got an answer and that the reported distances are real.
assert len( routv ) == n and len( soutv ) == n and len( toutv ) == n and len( doutv ) == n, "FindRSTVecGuess result count"
for i in range( len( doutv ) ):
    assert doutv[i] >= 0.0, "FindRSTVecGuess distance"

See also: FindRSTVec, :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pts vector<vec3d> Input vector of 3D coordinate points :param [in]: r0s vector<double> Input vector of U (0 - 1.0) volume coordinate guesses :param [in]: s0s vector<double> Input vector of S (0 - 1.0) volume coordinate guesses :param [in]: t0s vector<double> Input vector of T (0 - 1.0) volume coordinate guesses :param [out]: r_out_vec vector<double> Output vector of the closest R (0 - 1.0) volume coordinate for each 3D input point :param [out]: s_out_vec vector<double> Output vector of the closest S (0 - 1.0) volume coordinate for each 3D input point :param [out]: t_out_vec vector<double> Output vector of the closest T (0 - 1.0) volume coordinate for each 3D input point :param [out]: d_out_vec vector<double> Output vector of distances for each 3D point and the closest point of the volume

openvsp.ConvertRSTtoLMNVec(geom_id, surf_indx, r_vec, s_vec, t_vec)[source]

Convert vector of RST volumetric coordinates to LMN coordinates.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

rvec = [0]*n
svec = [0]*n
tvec = [0]*n

for i in range(n):

    rvec[i] = (i+1)*1.0/(n+1)
    svec[i] = (n-i)*1.0/(n+1)
    tvec[i] = (i+1)*1.0/(n+1)



lvec, mvec, nvec = ConvertRSTtoLMNVec( geom_id, 0, rvec, svec, tvec )

See also: ConvertLMNtoRSTVec, ConvertRSTtoLMN, ConvertLMNtoRST :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: r_vec vector<double> Input vector of R (0 - 1) volumetric coordinate :param [in]: s_vec vector<double> Input vector of S (0 - 1) volumetric coordinate :param [in]: t_vec vector<double> Input vector of T (0 - 1) volumetric coordinate :param [out]: l_out_vec vector<double> Output vector of L (0 - 1) linear volumetric coordinate :param [out]: m_out_vec vector<double> Output vector of M (0 - 1) linear volumetric coordinate :param [out]: n_out_vec vector<double> Output vector of N (0 - 1) linear volumetric coordinate

openvsp.ConvertLMNtoRSTVec(geom_id, surf_indx, l_vec, m_vec, n_vec)[source]

Convert vector of LMN volumetric coordinates to RST coordinates.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

lvec = [0]*n
mvec = [0]*n
nvec = [0]*n

for i in range(n):

    lvec[i] = (i+1)*1.0/(n+1)
    mvec[i] = (n-i)*1.0/(n+1)
    nvec[i] = (i+1)*1.0/(n+1)

rvec, svec, tvec = ConvertLMNtoRSTVec( geom_id, 0, lvec, mvec, nvec )

# One triple out per triple in, each matching the scalar form, and the whole
# conversion invertible.
lback, mback, nback = ConvertRSTtoLMNVec( geom_id, 0, rvec, svec, tvec )

assert len( rvec ) == n, "ConvertLMNtoRSTVec returned the wrong number of values"
assert len( svec ) == n, "ConvertLMNtoRSTVec returned the wrong number of values"
assert len( tvec ) == n, "ConvertLMNtoRSTVec returned the wrong number of values"

for i in range(n):
    r_one, s_one, t_one = ConvertLMNtoRST( geom_id, 0, lvec[i], mvec[i], nvec[i] )

    assert abs( rvec[i] - r_one ) < 1e-9, "ConvertLMNtoRSTVec disagrees with ConvertLMNtoRST at " + str( i )
    assert abs( svec[i] - s_one ) < 1e-9, "ConvertLMNtoRSTVec disagrees with ConvertLMNtoRST at " + str( i )
    assert abs( tvec[i] - t_one ) < 1e-9, "ConvertLMNtoRSTVec disagrees with ConvertLMNtoRST at " + str( i )

    assert abs( lback[i] - lvec[i] ) < 1e-6, "ConvertLMNtoRSTVec does not invert at " + str( i )
    assert abs( mback[i] - mvec[i] ) < 1e-6, "ConvertLMNtoRSTVec does not invert at " + str( i )
    assert abs( nback[i] - nvec[i] ) < 1e-6, "ConvertLMNtoRSTVec does not invert at " + str( i )

See also: ConvertRSTtoLMNVec, ConvertRSTtoLMN, ConvertLMNtoRST :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: l_vec vector<double> Input vector of L (0 - 1) linear volumetric coordinate :param [in]: m_vec vector<double> Input vector of M (0 - 1) linear volumetric coordinate :param [in]: n_vec vector<double> Input vector of N (0 - 1) linear volumetric coordinate :param [out]: r_out_vec vector<double> Output vector of R (0 - 1) volumetric coordinate :param [out]: s_out_vec vector<double> Output vector of S (0 - 1) volumetric coordinate :param [out]: t_out_vec vector<double> Output vector of T (0 - 1) volumetric coordinate

openvsp.GetUWTess01(geom_id, surf_indx)[source]

Get the surface coordinate point of each intersection of the tessellated wireframe for a particular surface

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

utess, wtess = GetUWTess01( geom_id, surf_indx )

# The wireframe spans the whole surface and never runs backwards.
assert len( utess ) >= 2, "GetUWTess01 returned too few stations"
assert len( wtess ) >= 2, "GetUWTess01 returned too few stations"

assert abs( utess[0] ) < 1e-9 and abs( utess[-1] - 1.0 ) < 1e-9, "GetUWTess01 does not span the surface"
assert abs( wtess[0] ) < 1e-9 and abs( wtess[-1] - 1.0 ) < 1e-9, "GetUWTess01 does not span the surface"

for i in range( 1, len( utess ) ):
    assert utess[i] > utess[i - 1], "the U stations are not increasing at " + str( i )

for i in range( 1, len( wtess ) ):
    assert wtess[i] > wtess[i - 1], "the W stations are not increasing at " + str( i )
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [out] – u_out_vec vector<double> Output vector of U (0 - 1) surface coordinates

  • [out] – w_out_vec vector<double> Output vector of W (0 - 1) surface coordinates