## Editor
Class TetrahedronBuilder

source: C:\XIII\Editor\Classes\TetrahedronBuilder.uc

    Core.Object
       |
       +--Editor.BrushBuilder
          |
          +--Editor.TetrahedronBuilder

Direct Known Subclasses:None

class TetrahedronBuilder
extends Editor.BrushBuilder

    //=============================================================================
    // TetrahedronBuilder: Builds an octahedron (not tetrahedron) - experimental.
    //=============================================================================

Variables
`name` | `GroupName`
`float` | `Radius`
`int` | `SphereExtrapolation`

Function Summary
`void` | `BuildTetrahedron(float R, int SphereExtrapolation)`
`void` | `Extrapolate(int a, int b, int c, int Count, float Radius)`

Source Code

    00001	//=============================================================================
    00002	// TetrahedronBuilder: Builds an octahedron (not tetrahedron) - experimental.
    00003	//=============================================================================
    00004	class TetrahedronBuilder
    00005		extends BrushBuilder;
    00006
    00007	var() float Radius;
    00008	var() int SphereExtrapolation;
    00009	var() name GroupName;
    00010
    00011	function Extrapolate( int a, int b, int c, int Count, float Radius )
    00012	{
    00013		local int ab,bc,ca;
    00014		if( Count>1 )
    00015		{
    00016			ab=Vertexv( Radius*Normal(GetVertex(a)+GetVertex(b)) );
    00017			bc=Vertexv( Radius*Normal(GetVertex(b)+GetVertex(c)) );
    00018			ca=Vertexv( Radius*Normal(GetVertex(c)+GetVertex(a)) );
    00019			Extrapolate(a,ab,ca,Count-1,Radius);
    00020			Extrapolate(b,bc,ab,Count-1,Radius);
    00021			Extrapolate(c,ca,bc,Count-1,Radius);
    00022			Extrapolate(ab,bc,ca,Count-1,Radius);
    00023			//wastes shared vertices
    00024		}
    00025		else Poly3i(+1,a,b,c);
    00026	}
    00027
    00028	function BuildTetrahedron( float R, int SphereExtrapolation )
    00029	{
    00030		vertex3f( R,0,0);
    00031		vertex3f(-R,0,0);
    00032		vertex3f(0, R,0);
    00033		vertex3f(0,-R,0);
    00034		vertex3f(0,0, R);
    00035		vertex3f(0,0,-R);
    00036
    00037		Extrapolate(2,1,4,SphereExtrapolation,Radius);
    00038		Extrapolate(1,3,4,SphereExtrapolation,Radius);
    00039		Extrapolate(3,0,4,SphereExtrapolation,Radius);
    00040		Extrapolate(0,2,4,SphereExtrapolation,Radius);
    00041		Extrapolate(1,2,5,SphereExtrapolation,Radius);
    00042		Extrapolate(3,1,5,SphereExtrapolation,Radius);
    00043		Extrapolate(0,3,5,SphereExtrapolation,Radius);
    00044		Extrapolate(2,0,5,SphereExtrapolation,Radius);
    00045	}
    00046
    00047	event bool Build()
    00048	{
    00049		if( Radius<=0 || SphereExtrapolation<=0 )
    00050			return BadParameters();
    00051
    00052		BeginBrush( false, GroupName );
    00053		BuildTetrahedron( Radius, SphereExtrapolation );
    00054		return EndBrush();
    00055	}
    00056
    00057	defaultproperties
    00058	{
    00059	     Radius=256.000000
    00060	     SphereExtrapolation=1
    00061	     GroupName="Tetrahedron"
    00062	     BitmapFilename="BBSphere"
    00063	     ToolTip="Tetrahedron (Sphere)"
    00064	}

End Source Code