<?php # Draw some simple shapes print "Drawing some basic shapes\n"; require "simple.php"; $cmap = new_ColorMap(); $f = new_FrameBuffer(400, 400); # Clear the picture FrameBuffer_clear($f, BLACK); # Make a red box FrameBuffer_box($f, 40, 40, 200, 200, RED); # Make a blue circle FrameBuffer_circle($f, 200, 200, 40, BLUE); # Make green line FrameBuffer_line($f, 10, 390, 390, 200, GREEN); # Write an image out to disk FrameBuffer_writeGIF($f, $cmap, "image.gif"); print "Wrote image.gif\n"; delete_FrameBuffer($f); delete_ColorMap($cmap); ?>
function func($x, $y) { return 5 * cos(2 * sqrt($x * $x + $y * $y)) * exp(-0.3 * sqrt($x * $x + $y * $y)); } # Here are some plotting parameters $xmin = -5.0; $xmax = 5.0; $ymin = -5.0; $ymax = 5.0; $zmin = -5.0; $zmax = 5.0; # Grid resolution $nxpoints = 60; $nypoints = 60; $cmap = new_ColorMap("cmap"); $frame = new_FrameBuffer(500, 500); FrameBuffer_clear($frame, BLACK); $p3 = new_Plot3D($frame, $xmin, $ymin, $zmin, $xmax, $ymax, $zmax); Plot3D_lookat($p3, 2 * ($zmax - $zmin)); Plot3D_autoperspective($p3, 40); Plot3D_rotu($p3, 60); Plot3D_rotr($p3, 30); Plot3D_rotd($p3, 10); function drawsolid() { global $p3; global $xmax; global $xmin; global $ymax; global $ymin; global $zmin;