# Libpg : A parametrics/constraint library

## Contents

# libpg : A parametrics/ constraint library

Proposed sytem for parametrics and constraint implementation by Dawn Thomas (homovulgaris)

Provision for Parametrics and constraints greatly improves the performance of a Computer Aided Design System both in terms of geometry generation as well as analysis. Considering the unix model of division into multiple tools and libraries for individual functions as well as the fact that parametric/constraint functionalities are **not critical** elements in terms of geometry generation and raytracing, a logical solution would be the implemenation of a separate library (libpg)

## Function

libpg adds the following provisions to BRL-CAD system

- Creation & Modification of parameter-based geometry objects
- Creation of constraints between geometry objects
- Creation & Storage of Parametric Objects (non-geometric)
- Modification of geometry objects in .g files to indicate parametric nature

Part 1 would include building parametric objects based on existing non-parametric geometry objects as well as generation of purely parametric geometry. libpg acts as a library which sits above librt using the librt methods for creation and modification of geometry

## Architecture

The above mentioned functionalities can be clearly expressed as the following capabilities which libpg provides any application

- Input/Output
- Reader
- Writer

- Geometry Translation
- Instantiation/Construction
- Analytic Evaluation
- Numeric Evaluation

Reader and Writer are the respective set of functions which deal with reading and writing information from and onto the .g database constraint files, command input etc. Geometry translation is a primarily a feature for interoperability of libpg package with other CAD geometry systems. Using this method we can follow an independent system of geometry type within libpg if necessary and the Geometry Translation function effectively translates any type of geometry into the libpg standard. libpg standard can be the .g standard of geometry type itself. Using the data thus translated or read from the database , Instantiation and construction of objects is undertaken.

A system of **Object overlay** is very efficient in the production of parametric geometry objects. Basically for every non-parametric geometry object which is used in the generation of a parametric geometry object we create an equivalent parametric geometric object and use it as an overlay. In this way we will have a comprehensive list of all geometry used in parametrization and would simplify procedure calling.

Once the existing objects are thus instantiated in the cache / display ( which would solve the problem of timestamping in a sense ) equation evaluation is done for generation of new geometry objects. As shown below in the object structure the various details required for the creation of a new parametric object are

- Parent Set
- Parameter Set

Evaluation system is further detailed out below

## Object Architecture

An object oriented method of implementation would be the creation of a mixed ( in the sense that they contain both geometric and non-geometric information ) object. The object architecture is as shown below which shows the data types as well as the public and private methods

## Notes

### Object Overlay

### Extensibility

===Interoperability