das2C
das core C utilities (v3)
Loading...
Searching...
No Matches
Macros | Functions
form_vector.h File Reference

A frame-tagged geometric vector. More...

#include <das3/form.h>
Include dependency graph for form_vector.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DAS_FORM_VEC   (&das_form_vector_vtbl)
 A geometric vector in a reference frame.
 

Functions

DAS_API const char * das_vsys_str (ubyte uSys)
 Wire token for a system code, or NULL if it is not one of this file's.
 
DAS_API ubyte das_vsys_id (const char *sSys)
 Wire token to system code, 0 if unrecognized here.
 
DAS_API const char * das_vsys_desc (ubyte uSys)
 One line of prose about a system, for a "notes" property.
 
DAS_API const char * das_vsys_symbol (ubyte uSys, int iDir)
 The canonical symbol for direction iDir of a system: "x", "r", "λ" ...
 
DAS_API int8_t das_vsys_index (ubyte uSys, const char *sSymbol)
 The inverse of das_vsys_symbol(): which direction a symbol names.
 
DAS_API double das_vsys_default (ubyte uSys, int iDir)
 The value an ABSENT component of this system defaults to.
 
DAS_API bool das_vsys_toCart (ubyte uSys, const double *pIn, double *pOut)
 Convert one vector from its system to cartesian.
 
DAS_API bool das_vsys_fromCart (ubyte uSys, const double *pIn, double *pOut)
 The inverse of das_vsys_toCart().
 

Detailed Description

A frame-tagged geometric vector.

NO origin.

A magnetic field, a velocity, a displacement: something with direction and magnitude that is not measured FROM anywhere. Free vectors add, subtract and scale, and one day will dot and cross.

Contrast form_geoloc.h, which is the same components with an ORIGIN and is therefore an affine point: positions subtract to give one of these, and two of them cannot be added at all. The discriminator is the origin, which is why they are two formalisms and not one with a flag.

surface= and center= are ILLEGAL here and say so loudly. A surface is an ellipsoid reference and a center is an origin; a free vector has neither, so the systems needing them (detic, graphic) belong to geoloc.

Parameters:

frame= the frame's NAME. OPTIONAL: a frameless vector is legal, it just cannot be frame-checked against anything. body= describes the FRAME, and rides here because there is no frame object to fold it into. Two vectors in one frame can therefore disagree; the library carries both and the consumer decides. fixed= true when the frame does not rotate. system= cartesian | cylindrical | spherical | centric. Default cartesian, which is what nearly all measured data is. sysorder= which canonical direction each stored component holds, e.g. "1;0;2". Default ascending.

ANGLES ARE ALWAYS DEGREES on the wire, so units carries whatever the radial component is in. The conversion helpers below take and return degrees for that reason.

Macro Definition Documentation

◆ DAS_FORM_VEC

#define DAS_FORM_VEC   (&das_form_vector_vtbl)

A geometric vector in a reference frame.

It has a direction and a magnitude but no starting point, so two of them add.

See also
DasForm_isKind(), DasVar_formIs().

Function Documentation

◆ das_vsys_str()

DAS_API const char * das_vsys_str ( ubyte  uSys)

Wire token for a system code, or NULL if it is not one of this file's.

form_geoloc.h has das_geosys_str() for the superset.

◆ das_vsys_desc()

DAS_API const char * das_vsys_desc ( ubyte  uSys)

One line of prose about a system, for a "notes" property.

NULL if not one of this file's.

◆ das_vsys_symbol()

DAS_API const char * das_vsys_symbol ( ubyte  uSys,
int  iDir 
)

The canonical symbol for direction iDir of a system: "x", "r", "λ" ...

Returns
a constant symbol, or NULL for a bad system or direction.

◆ das_vsys_index()

DAS_API int8_t das_vsys_index ( ubyte  uSys,
const char *  sSymbol 
)

The inverse of das_vsys_symbol(): which direction a symbol names.

Returns
the direction index, or -1 if the symbol is not in the system.

◆ das_vsys_default()

DAS_API double das_vsys_default ( ubyte  uSys,
int  iDir 
)

The value an ABSENT component of this system defaults to.

Zero everywhere except a radius, which defaults to 1 so an angles-only vector reads as a unit direction rather than as a null vector. Positions want different defaults; see form_geoloc.h.

◆ das_vsys_toCart()

DAS_API bool das_vsys_toCart ( ubyte  uSys,
const double *  pIn,
double *  pOut 
)

Convert one vector from its system to cartesian.

Returns
false loudly for a system with no kernel-free conversion (detic, graphic), which are geoloc's business.