User:Le Forgeron/compound

From POV-Wiki
< User:Le Forgeron
Revision as of 08:10, 3 June 2019 by Le Forgeron (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Access to part of compound object

Compound objects can be made of:

  • Constructive Solid Geometry (CSG : difference, union, merge, intersection)
  • Generalised Symmetric Difference (GSD: interunion, intermerge)

Data access

The children function take an object as parameter, and return the number of first level sub-objects in it.

  • if parameter is not compound compatible, it returns -1

Getting a copy of an object inside a compound object

A small SDL extension, to retrieve the object inside an existing compound object (CSG or GSD).

child ( Compound_Object_ID , Index )

The index start at 0 for the first child of the CSG. Only the first level of the CSG is explored (recursion in CSG structure must be handled the same way: with recursion).

It is recommended to use children( Compound_Object_ID ) to check the object first, as child generates an error whenever:

  • the object is not compound
  • the index is out of bound in regard to the number of first level subobject in the compound object