Custom Search

Fountain Products
 Cave Surveying
Cave Survey Software
 Free Utilities, Tools
Web Image Tracker
Sports Audio Delay
Time Calibrator
Spectrum Analyzer
Used Car Evaluater
Terrain Modeling
Free Topo Maps
XEdit Text Editor
EXPL Language
 Fun Stuff
  Games
     Arachnid-32
     Eight-X Solitaire
 Math, Computers
  3D Mandelbrots
  Super-Spirograph
  6502 Memorabilia
 

If you like our Programs Please Leave A TIP

  3D Mandel Box Code
var FixedRadius: double = 1.0;
var MinRadius: double	= 0.5;
var Scale: double = -1.7;
var Escape: integer = 16;



function MandelBox3D(V: TGridPoint): double;
{Test to see if point is inside or outside Mandel Box Set}
{Returns 1 if inside set, 0 if outside}
var Point,C: T3DVector;
var Iter: integer;
var Len: double;
var RadiusRatio: double;


	procedure BoxFold(var Pnt: T3DVector);
	begin
	if Pnt.X > 1 then Pnt.X := 2 - Pnt.X
	else if Pnt.X < -1 then Pnt.X := -2 - Pnt.X;

	if Pnt.Y > 1 then Pnt.Y := 2 - Pnt.Y
	else if Pnt.Y < -1 then Pnt.Y := -2 - Pnt.Y;

	if Pnt.Z > 1 then Pnt.Z := 2 - Pnt.Z
	else if Pnt.Z < -1 then Pnt.Z := -2 - Pnt.Z;
	end;


	procedure BallFold(var Pnt: T3DVector);
	var Radius,RF: double;
	begin
	Radius := sqrt(Sqr(Pnt.X) + Sqr(Pnt.Y) + Sqr(Pnt.Z));
	if Radius < MinRadius then
		begin
		Pnt.X := Pnt.X * RadiusRatio;
		Pnt.Y := Pnt.Y * RadiusRatio;
		Pnt.Z := Pnt.Z * RadiusRatio;
		end
	else if Radius < FixedRadius then
		begin
		RF := Sqr(FixedRadius) / Sqr(Radius);
		Pnt.X := Pnt.X * RF;
		Pnt.Y := Pnt.Y * RF;
		Pnt.Z := Pnt.Z * RF;
		end
	end;



begin
C:=V.P;
RadiusRatio := sqr(FixedRadius) / sqr(MinRadius);
Point:=MakeVector3D(0,0,0);
Result:=1;
for Iter:=0 to Iterations-1 do
	begin
	BoxFold(Point);
	BallFold(Point);
	Point.X := Point.X * Scale;
	Point.Y := Point.Y * Scale;
	Point.Z := Point.Z * Scale;
	Point.X := Point.X + C.X;
	Point.Y := Point.Y + C.Y;
	Point.Z := Point.Z + C.Z;
	Len := sqrt(sqr(Point.X) + sqr(Point.Y) + sqr(Point.Z));
	if Len > Escape then exit;
	end;
Result:=0;
end;
	

Contact Us

Custom Search