Difference between revisions of "User:Le Forgeron/compound"

From POV-Wiki
Jump to navigation Jump to search
(Created page with "{{User:Le_Forgeron/HgPovray38/soon}} == Access to part of compound object == Compound objects can be made of: * Constructive Solid Geometry (CSG : difference, union, merge, ...")
 
 
Line 1: Line 1:
{{User:Le_Forgeron/HgPovray38/soon}}
+
{{User:Le_Forgeron/HgPovray38/available}}
  
 
== Access to part of compound object ==
 
== Access to part of compound object ==
Line 5: Line 5:
 
Compound objects can be made of:
 
Compound objects can be made of:
 
* Constructive Solid Geometry (CSG : difference, union, merge, intersection)
 
* Constructive Solid Geometry (CSG : difference, union, merge, intersection)
* Generalised Symetric Difference ([[User:Le_Forgeron/gsd|GSD]]: interunion, intermerge)
+
* Generalised Symmetric Difference ([[User:Le_Forgeron/gsd|GSD]]: interunion, intermerge)
  
 
=== Data access ===
 
=== Data access ===
Line 18: Line 18:
  
 
<pre>
 
<pre>
child { CSG_Object_ID }( Index )
+
child ( Compound_Object_ID , Index )
 
</pre>
 
</pre>
  
 
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).
 
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 <code>children( CSG_Object_ID )</code> to check the object first, as <code>child</code> generates an error whenever:
+
It is recommended to use <code>children( Compound_Object_ID )</code> to check the object first, as <code>child</code> generates an error whenever:
 
* the object is not compound
 
* the object is not compound
 
* the index is out of bound in regard to the number of first level subobject in the compound object
 
* the index is out of bound in regard to the number of first level subobject in the compound object

Latest revision as of 08:10, 3 June 2019

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