pe_unit_new

Creates a new unit of measure

Usage syntax

PE_UNIT pe_unit_new (const char *name, double factor);

Parameters
name Name of the new unit
factor The ratio of meters/unit for linear units or radians/unit for angular units
Description

Defines a new unit of measure with the specified attributes

The value of the factor is either (a) number of meters per 1 unit for linear units or (b) number of radians per 1 unit for angular units.

x meters = factor * 1 unit, i.e., factor = meters / unit

1 unit = n meters, where n =  factor

1 meter = n units ,  where n = 1 / factor

x radians = factor * 1 unit, i.e., factor = radians / unit

1 unit = n radians, where n =  factor

1 radian = n units ,  where n = 1 / factor

Returns

On success, the new unit with the attributes equal to the corresponding arguments; on failure, a null pointer

Examples

PE_UNIT ft = pe_unit_new("ft",0.3048);
PE_UNIT dd = pe_unit_new("deg",PI/180);