OpenVSPAPI  3.20.0
Functions
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.

Click here to return to the main page. More...

Functions

vec3d CompPnt01 (const string &in geom_id, const int &in surf_indx, const double &in u, const double &in w)
 
vec3d CompNorm01 (const string &in geom_id, const int &in surf_indx, const double &in u, const double &in w)
 
vec3d CompTanU01 (const string &in geom_id, const int &in surf_indx, const double &in u, const double &in w)
 
vec3d CompTanW01 (const string &in geom_id, const int &in surf_indx, const double &in u, const double &in w)
 
void CompCurvature01 (const string &in geom_id, const int &in surf_indx, const double &in u, const double &in w, double &out k1, double &out k2, double &out ka, double &out kg)
 
double ProjPnt01 (const string &in geom_id, const int &in surf_indx, const vec3d &in pt, double &out u, double &out w)
 
double ProjPnt01I (const string &in geom_id, const vec3d &in pt, int &out surf_indx, double &out u, double &out w)
 
double ProjPnt01Guess (const string &in geom_id, const int &in surf_indx, const vec3d &in pt, const double &in u0, const double &in w0, double &out u, double &out w)
 
void GetUWTess01 (const string &in geom_id, int &in surf_indx, double[]@ us, double[]@ ws)
 
vec3d[] CompVecPnt01 (const string &in geom_id, const int &in surf_indx, double[]@ us, double[]@ ws)
 
vec3d[] CompVecNorm01 (const string &in geom_id, const int &in surf_indx, double[]@ us, double[]@ ws)
 
void CompVecCurvature01 (const string &in geom_id, const int &in surf_indx, double[]@ us, double[]@ ws, double[]@ k1s, double[]@ k2s, double[]@ kas, double[]@ kgs)
 
void ProjVecPnt01 (const string &in geom_id, int &in surf_indx, vec3d[]@ pts, double[]@ us, double[]@ ws, double[]@ ds)
 
void ProjVecPnt01Guess (const string &in geom_id, int &in surf_indx, vec3d[]@ pts, double[]@ u0s, double[]@ w0s, double[]@ us, double[]@ ws, double[]@ ds)
 

Detailed Description

Function Documentation

◆ CompCurvature01()

void CompCurvature01 ( const string &in  geom_id,
const int &in  surf_indx,
const double &in  u,
const double &in  w,
double &out  k1,
double &out  k2,
double &out  ka,
double &out  kg 
)

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

// Add Pod Geom
string pid = AddGeom( "POD", "" );
int surf_indx = 0;
double k1, k2, ka, kg;
CompCurvature01( pid, surf_indx, u, w, k1, k2, ka, kg );
Print( "Curvature : k1 " + k1 + " k2 " + k2 + " ka " + ka + " kg " + kg );
Parameters
[in]geom_idParent Geom ID
[in]surf_indxMain surface index from the parent Geom
[in]uU (0 - 1) surface coordinate
[in]wW (0 - 1) surface coordinate
[out]k1Output value of maximum principal curvature
[out]k2Output value of minimum principal curvature
[out]kaOutput value of mean curvature
[out]kgOutput value of Gaussian curvature

◆ CompNorm01()

vec3d CompNorm01 ( const string &in  geom_id,
const int &in  surf_indx,
const double &in  u,
const double &in  w 
)

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

// Add Pod Geom
string pid = AddGeom( "POD", "" );
int surf_indx = 0;
double u = 0.12345;
double w = 0.67890;
vec3d norm = CompNorm01( pid, surf_indx, u, w );
Print( "Point: ( " + norm.x() + ', ' + norm.y() + ', ' + norm.z() + ' )' );
Parameters
[in]geom_idParent Geom ID
[in]surf_indxMain surface index from the parent Geom
[in]uU (0 - 1) surface coordinate
[in]wW (0 - 1) surface coordinate
Returns
Normal vector

◆ CompPnt01()

vec3d CompPnt01 ( const string &in  geom_id,
const int &in  surf_indx,
const double &in  u,
const double &in  w 
)

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

// Add Pod Geom
string pid = AddGeom( "POD", "" );
int surf_indx = 0;
double u = 0.12345;
double w = 0.67890;
vec3d pnt = CompPnt01( pid, surf_indx, u, w );
Print( "Point: ( " + pnt.x() + ', ' + pnt.y() + ', ' + pnt.z() + ' )' );
Parameters
[in]geom_idParent Geom ID
[in]surf_indxMain surface index from the parent Geom
[in]uU (0 - 1) surface coordinate
[in]wW (0 - 1) surface coordinate
Returns
Normal vector3D coordinate point

◆ CompTanU01()

vec3d CompTanU01 ( const string &in  geom_id,
const int &in  surf_indx,
const double &in  u,
const double &in  w 
)

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

// Add Pod Geom
string pid = AddGeom( "POD", "" );
int surf_indx = 0;
double u = 0.12345;
double w = 0.67890;
vec3d tanu = CompTanU01( pid, surf_indx, u, w );
Print( "Point: ( " + tanu.x() + ', ' + tanu.y() + ', ' + tanu.z() + ' )' );
Parameters
[in]geom_idParent Geom ID
[in]surf_indxMain surface index from the parent Geom
[in]uU (0 - 1) surface coordinate
[in]wW (0 - 1) surface coordinate
Returns
Tangent vector in U direction

◆ CompTanW01()

vec3d CompTanW01 ( const string &in  geom_id,
const int &in  surf_indx,
const double &in  u,
const double &in  w 
)

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

// Add Pod Geom
string pid = AddGeom( "POD", "" );
int surf_indx = 0;
double u = 0.12345;
double w = 0.67890;
vec3d tanw = CompTanW01( pid, surf_indx, u, w );
Print( "Point: ( " + tanw.x() + ', ' + tanw.y() + ', ' + tanw.z() + ' )' );
Parameters
[in]geom_idParent Geom ID
[in]surf_indxMain surface index from the parent Geom
[in]uU (0 - 1) surface coordinate
[in]wW (0 - 1) surface coordinate
Returns
Tangent vector in W direction

◆ CompVecCurvature01()

void CompVecCurvature01 ( const string &in  geom_id,
const int &in  surf_indx,
double@[]  us,
double@[]  ws,
double@[]  k1s,
double@[]  k2s,
double@[]  kas,
double@[]  kgs 
)

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

// Add Pod Geom
string pid = AddGeom( "POD", "" );
int n = 5;
array<double> uvec, wvec;
uvec.resize( n );
wvec.resize( n );
for( int i = 0 ; i < n ; i++ )
{
uvec[i] = (i+1)*1.0/(n+1);
wvec[i] = (n-i)*1.0/(n+1);
}
array<double> k1vec, k2vec, kavec, kgvec;
CompVecCurvature01( pid, 0, uvec, wvec, k1vec, k2vec, kavec, kgvec );
Parameters
[in]geom_idParent Geom ID
[in]surf_indxMain surface index from the parent Geom
[in]usInput array of U (0 - 1) surface coordinates
[in]wsInput array of W (0 - 1) surface coordinates
[out]k1sOutput array of maximum principal curvatures
[out]k2sOutput array of minimum principal curvatures
[out]kasOutput array of mean curvatures
[out]kgsOutput array of Gaussian curvatures

◆ CompVecNorm01()

vec3d [] CompVecNorm01 ( const string &in  geom_id,
const int &in  surf_indx,
double@[]  us,
double@[]  ws 
)

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

// Add Pod Geom
string pid = AddGeom( "POD", "" );
int n = 5;
array<double> uvec, wvec;
uvec.resize( n );
wvec.resize( n );
for( int i = 0 ; i < n ; i++ )
{
uvec[i] = (i+1)*1.0/(n+1);
wvec[i] = (n-i)*1.0/(n+1);
}
array< vec3d > normvec = CompVecNorm01( pid, 0, uvec, wvec );
Parameters
[in]geom_idParent Geom ID
[in]surf_indxMain surface index from the parent Geom
[in]usInput array of U (0 - 1) surface coordinates
[in]wsInput array of W (0 - 1) surface coordinates
Returns
Array of 3D normal vectors

◆ CompVecPnt01()

vec3d [] CompVecPnt01 ( const string &in  geom_id,
const int &in  surf_indx,
double@[]  us,
double@[]  ws 
)

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

// Add Pod Geom
string pid = AddGeom( "POD", "" );
int n = 5;
array<double> uvec, wvec;
uvec.resize( n );
wvec.resize( n );
for( int i = 0 ; i < n ; i++ )
{
uvec[i] = (i+1)*1.0/(n+1);
wvec[i] = (n-i)*1.0/(n+1);
}
array< vec3d > ptvec = CompVecPnt01( pid, 0, uvec, wvec );
Parameters
[in]geom_idParent Geom ID
[in]surf_indxMain surface index from the parent Geom
[in]usInput array of U (0 - 1) surface coordinates
[in]wsInput array of W (0 - 1) surface coordinates
Returns
Array of 3D coordinate points

◆ GetUWTess01()

void GetUWTess01 ( const string &in  geom_id,
int &in  surf_indx,
double@[]  us,
double@[]  ws 
)

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

// Add Pod Geom
string pid = AddGeom( "POD", "" );
int surf_indx = 0;
array<double> utess, wtess;
GetUWTess01( pid, surf_indx, utess, wtess );
Parameters
[in]geom_idParent Geom ID
[in]surf_indxMain surface index from the parent Geom
[out]usOutput array of U (0 - 1) surface coordinates
[out]wsOutput array of W (0 - 1) surface coordinates

◆ ProjPnt01()

double ProjPnt01 ( const string &in  geom_id,
const int &in  surf_indx,
const vec3d &in  pt,
double &out  u,
double &out  w 
)

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
string pid = AddGeom( "POD", "" );
int surf_indx = 0;
double u = 0.12345;
double w = 0.67890;
vec3d pnt = CompPnt01( pid, surf_indx, u, w );
vec3d norm = CompNorm01( gid, surf_indx, u, w );
double uout, wout;
// Offset point from surface
pnt = pnt + norm;
double d = ProjPnt01( pid, surf_indx, pnt, uout, wout );
Print( "Dist " + d + " u " + uout + " w " + wout );
See also
ProjPnt01Guess, ProjPnt01I
Parameters
[in]geom_idParent Geom ID
[in]surf_indxMain surface index from the parent Geom
[in]ptInput 3D coordinate point
[out]uOutput closest U (0 - 1) surface coordinate
[out]wOutput closest W (0 - 1) surface coordinate
Returns
Distance between the 3D point and the closest point of the surface

◆ ProjPnt01Guess()

double ProjPnt01Guess ( const string &in  geom_id,
const int &in  surf_indx,
const vec3d &in  pt,
const double &in  u0,
const double &in  w0,
double &out  u,
double &out  w 
)

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
string pid = AddGeom( "POD", "" );
int surf_indx = 0;
double u = 0.12345;
double w = 0.67890;
vec3d pnt = CompPnt01( pid, surf_indx, u, w );
vec3d norm = CompNorm01( gid, surf_indx, u, w );
double uout, wout;
// Offset point from surface
pnt = pnt + norm;
d = ProjPnt01Guess( pid, surf_indx, pnt, u + 0.1, w + 0.1, uout, wout );
Print( "Dist " + d + " u " + uout + " w " + wout );
See also
ProjPnt01, ProjPnt01I
Parameters
[in]geom_idParent Geom ID
[in]surf_indxMain surface index from the parent Geom
[in]ptInput 3D coordinate point
[in]u0Input U (0 - 1) surface coordinate guess
[in]w0Input W (0 - 1) surface coordinate guess
[out]uOutput closest U (0 - 1) surface coordinate
[out]wOutput closest W (0 - 1) surface coordinate
Returns
Distance between the 3D point and the closest point of the surface

◆ ProjPnt01I()

double ProjPnt01I ( const string &in  geom_id,
const vec3d &in  pt,
int &out  surf_indx,
double &out  u,
double &out  w 
)

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
string pid = AddGeom( "POD", "" );
int surf_indx = 0;
double u = 0.12345;
double w = 0.67890;
vec3d pnt = CompPnt01( pid, surf_indx, u, w );
vec3d norm = CompNorm01( gid, surf_indx, u, w );
double uout, wout;
int surf_indx_out;
// Offset point from surface
pnt = pnt + norm;
d = ProjPnt01I( pid, pnt, surf_indx_out, uout, wout );
Print( "Dist " + d + " u " + uout + " w " + wout + " surf_index " + surf_indx_out );
See also
ProjPnt01, ProjPnt01Guess
Parameters
[in]geom_idParent Geom ID
[in]ptInput 3D coordinate point
[in]surf_indxOutput main surface index from the parent Geom
[out]uOutput closest U (0 - 1) surface coordinat
[out]wOutput closest W (0 - 1) surface coordinat
Returns
Distance between the 3D point and the closest point of the surface

◆ ProjVecPnt01()

void ProjVecPnt01 ( const string &in  geom_id,
int &in  surf_indx,
vec3d@[]  pts,
double@[]  us,
double@[]  ws,
double@[]  ds 
)

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
string pid = AddGeom( "POD", "" );
int n = 5;
array<double> uvec, wvec;
uvec.resize( n );
wvec.resize( n );
for( int i = 0 ; i < n ; i++ )
{
uvec[i] = (i+1)*1.0/(n+1);
wvec[i] = (n-i)*1.0/(n+1);
}
array< vec3d > ptvec = CompVecPnt01( pid, 0, uvec, wvec );
array< vec3d > normvec = CompVecNorm01( gid, 0, uvec, wvec );
for( int i = 0 ; i < n ; i++ )
{
ptvec[i] = ptvec[i] + normvec[i];
}
array<double> uoutv, woutv, doutv;
ProjVecPnt01( pid, 0, ptvec, uoutv, woutv, doutv );
See also
ProjVecPnt01Guess
Parameters
[in]geom_idParent Geom ID
[in]surf_indxMain surface index from the parent Geom
[in]ptsInput array of 3D coordinate points
[out]usOutput array of the closest U (0 - 1) surface coordinate for each 3D input point
[out]wsOutput array of the closest W (0 - 1) surface coordinate for each 3D input point
[out]dsOutput array of distances for each 3D point and the closest point of the surface

◆ ProjVecPnt01Guess()

void ProjVecPnt01Guess ( const string &in  geom_id,
int &in  surf_indx,
vec3d@[]  pts,
double@[]  u0s,
double@[]  w0s,
double@[]  us,
double@[]  ws,
double@[]  ds 
)

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
string pid = AddGeom( "POD", "" );
int n = 5;
array<double> uvec, wvec;
uvec.resize( n );
wvec.resize( n );
for( int i = 0 ; i < n ; i++ )
{
uvec[i] = (i+1)*1.0/(n+1);
wvec[i] = (n-i)*1.0/(n+1);
}
array< vec3d > ptvec = CompVecPnt01( pid, 0, uvec, wvec );
array< vec3d > normvec = CompVecNorm01( gid, 0, uvec, wvec );
for( int i = 0 ; i < n ; i++ )
{
ptvec[i] = ptvec[i] + normvec[i];
}
array<double> uoutv, woutv, doutv, u0v, w0v;
u0v.resize( n );
w0v.resize( n );
for( int i = 0 ; i < n ; i++ )
{
u0v[i] = uvec[i] + 0.01234;
w0v[i] = wvec[i] - 0.05678;
}
ProjVecPnt01Guess( pid, 0, ptvec, u0v, w0v, uoutv, woutv, doutv );
See also
ProjVecPnt01,
Parameters
[in]geom_idParent Geom ID
[in]surf_indxMain surface index from the parent Geom
[in]ptsInput array of 3D coordinate points
[in]u0sInput array of U (0 - 1) surface coordinate guesses
[in]w0sInput array of W (0 - 1) surface coordinate guesses
[out]usOutput array of the closest U (0 - 1) surface coordinate for each 3D input point
[out]wsOutput array of the closest W (0 - 1) surface coordinate for each 3D input point
[out]dsOutput array of distances for each 3D point and the closest point of the surface
GetUWTess01
void GetUWTess01(const string &in geom_id, int &in surf_indx, double[]@ us, double[]@ ws)
vec3d::z
double z() const
CompVecNorm01
vec3d[] CompVecNorm01(const string &in geom_id, const int &in surf_indx, double[]@ us, double[]@ ws)
CompTanW01
vec3d CompTanW01(const string &in geom_id, const int &in surf_indx, const double &in u, const double &in w)
ProjVecPnt01Guess
void ProjVecPnt01Guess(const string &in geom_id, int &in surf_indx, vec3d[]@ pts, double[]@ u0s, double[]@ w0s, double[]@ us, double[]@ ws, double[]@ ds)
vec3d::x
double x() const
CompVecPnt01
vec3d[] CompVecPnt01(const string &in geom_id, const int &in surf_indx, double[]@ us, double[]@ ws)
CompVecCurvature01
void CompVecCurvature01(const string &in geom_id, const int &in surf_indx, double[]@ us, double[]@ ws, double[]@ k1s, double[]@ k2s, double[]@ kas, double[]@ kgs)
CompCurvature01
void CompCurvature01(const string &in geom_id, const int &in surf_indx, const double &in u, const double &in w, double &out k1, double &out k2, double &out ka, double &out kg)
vec3d::y
double y() const
ProjPnt01Guess
double ProjPnt01Guess(const string &in geom_id, const int &in surf_indx, const vec3d &in pt, const double &in u0, const double &in w0, double &out u, double &out w)
vec3d
A class for representing 3D vectors.
Definition: openvsp_as.h:341
ProjVecPnt01
void ProjVecPnt01(const string &in geom_id, int &in surf_indx, vec3d[]@ pts, double[]@ us, double[]@ ws, double[]@ ds)
CompPnt01
vec3d CompPnt01(const string &in geom_id, const int &in surf_indx, const double &in u, const double &in w)
array
AngelScript ScriptExtension for representing the C++ std::vector.
Definition: openvsp_as.h:244
ProjPnt01
double ProjPnt01(const string &in geom_id, const int &in surf_indx, const vec3d &in pt, double &out u, double &out w)
CompNorm01
vec3d CompNorm01(const string &in geom_id, const int &in surf_indx, const double &in u, const double &in w)
AddGeom
string AddGeom(const string &in type, const string &in parent=string())
Print
void Print(const string &in data, bool new_line=true)
ProjPnt01I
double ProjPnt01I(const string &in geom_id, const vec3d &in pt, int &out surf_indx, double &out u, double &out w)
CompTanU01
vec3d CompTanU01(const string &in geom_id, const int &in surf_indx, const double &in u, const double &in w)