Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

Editor.TetrahedronBuilder


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
//=============================================================================
// TetrahedronBuilder: Builds an octahedron (not tetrahedron) - experimental.
//=============================================================================
class TetrahedronBuilder
	extends BrushBuilder;

var() float Radius;
var() int SphereExtrapolation;
var() name GroupName;

function Extrapolate( int a, int b, int c, int Count, float Radius )
{
	local int ab,bc,ca;
	if( Count>1 )
	{
		ab=Vertexv( Radius*Normal(GetVertex(a)+GetVertex(b)) );
		bc=Vertexv( Radius*Normal(GetVertex(b)+GetVertex(c)) );
		ca=Vertexv( Radius*Normal(GetVertex(c)+GetVertex(a)) );
		Extrapolate(a,ab,ca,Count-1,Radius);
		Extrapolate(b,bc,ab,Count-1,Radius);
		Extrapolate(c,ca,bc,Count-1,Radius);
		Extrapolate(ab,bc,ca,Count-1,Radius);
		//wastes shared vertices
	}
	else Poly3i(+1,a,b,c);
}

function BuildTetrahedron( float R, int SphereExtrapolation )
{
	vertex3f( R,0,0);
	vertex3f(-R,0,0);
	vertex3f(0, R,0);
	vertex3f(0,-R,0);
	vertex3f(0,0, R);
	vertex3f(0,0,-R);

	Extrapolate(2,1,4,SphereExtrapolation,Radius);
	Extrapolate(1,3,4,SphereExtrapolation,Radius);
	Extrapolate(3,0,4,SphereExtrapolation,Radius);
	Extrapolate(0,2,4,SphereExtrapolation,Radius);
	Extrapolate(1,2,5,SphereExtrapolation,Radius);
	Extrapolate(3,1,5,SphereExtrapolation,Radius);
	Extrapolate(0,3,5,SphereExtrapolation,Radius);
	Extrapolate(2,0,5,SphereExtrapolation,Radius);
}

event bool Build()
{
	if( Radius<=0 || SphereExtrapolation<=0 )
		return BadParameters();

	BeginBrush( false, GroupName );
	BuildTetrahedron( Radius, SphereExtrapolation );
	return EndBrush();
}

defaultproperties
{
	Radius=256.000000
	SphereExtrapolation=1
	GroupName='Tetrahedron'
	BitmapFilename="BBSphere"
	ToolTip="Tetrahedron (Sphere)"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: sk 3-1-2016 10:38:40.000 - Creation time: sk 3-1-2016 10:48:42.285 - Created with UnCodeX