#### 11.1.1 Build3D

This command define the list of 3D elements that compose the scene. That command does not draw anything; as it can be seen in the example file display3d.teg, the different scene are built in macros, and one graphic element is enough, it contains the instruction Display3D(). That command calculate the scene (more precisely: it builds a display tree), and display the scene. If the viewing angle is changed, only the command Display3D() is updated, and not the command Build3D().

The general syntax for Build3D is the following:

• Build3D( <object1>, <object2>,...)
• Description: that function removes the existig scene and build a new one with the given objects as arguments, it returns Nil. Each object can be a list of several 3D objects, then delimited with the constant: sep3D. You will find further the building macros for Build3D, but here are presented the “atomic” objects. There are four kind of those objects, internally coded in the following manner:
• facets: in that case, the object has to be in the form:
[<$±$1+i*shade>, <color$±$i*opacity>, <facet list> ]

The value <-1> means the GOURAUD smoothing has to be used in the exports that can handle it. With the value <1> there is no smoothing. The <shade> is optional and is 0 by default. The <opacity> is optional and is 1 by default, else it must be a number between 0 and 1. If the opacity is multiplied by -i, it means, by convention, the front and the back of the face are not distinguished, while with +i the two sides do not have exactly the same color. The facets color is nuanced according to exposure. The parameter <nuance> can modify this. Its value must be greater or equal to -1:

• nuance=-1: no shading. All the facets have the same color,
• nuance=0: this is the default value,
• the higher the value is increased, the more the contrast increases.
• lines: in that case the object has to be in the form:
[<2>, <color+i*opacity>, <thickness+i*LineStyle>, <3Dpoint list> ]
• points: in that case the object has to be in the form:
[<3>, <color+i*opacity>, <width+i*linestyle, <3Dpoint list> ]
• labels: in that case, the object has to be in the form:
[<3+i>, <color+i*number>, <labelsize+i*labelstyle>, <[pos,dir]> ]
• compiled labels:
[<3-i>, <color+i*number>, <labelsize+i*labelstyle>, <[pos,dir]> ]
• Some macros from the file scene3d.mac (loaded at startup) simplify the definition of elements in a 3D scene and can be used as arguments with the command Build3D. All these macros contain a list of options in their last argument. An option is declared like the following: <name> := <value>.
• Exemple(s): a cut sphere is drawn, a plane, a cylinder, then the axes with the hidden lines.

 \begin{texgraph}[name=Build3D, export=eps]    view(-5.5,5.5,-5.5,5.5),Marges(0,0,0,0),    size(7.5),background(full,beige),    z:=-2,    Build3D(      bdPlan([M(0,0,z), vecK],        [color:=gold,border:=0,bordercolor:=black]),      bdCylinder(M(-2,3,2), 7*M(2/3,-1,-2/3), 1,        [color:=slategray,smooth:=1]),      bdSphere(Origin, 3,        [color:=darkseagreen, clip:=-1,         clipwin:=[M(2,1,1),M(-1,-1,-1)],         smooth:=1, backculling:=0]),      bdCercle(M(0,0,z),sqrt(5),vecK,        [color:=blue, width:=12]),      bdAxes([0,0],        [hidden:=1, arrows:=1,color:=firebrick])       ),    Display3D()   \end{texgraph}

Build3D