This last recipe in the chapter is probably also the most advanced in the entire book, but it can be used to create an impressive effect.
In this recipe, we define our own generated 3D object, not based on cubes or other existing shapes. To obtain this result, we define a very basic geometry that we used to build a custom shape.
The starting setup is similar as before. We will define a new class to hold our graph. So copy any of the previous recipes, but remove all references to Graph3D
and the data from it.
The idea here is to plot a three-dimensional function:
y = (sin(x)² . cos(z)²) / (5 . x² . z²)
We will use Flash's built-in
Vector3D
class to clean up some of the code.Vector3D
is an object that simply holds the tree's x, y, and z values of a point in the 3D world.We will work from the bottom up. First create a new class called
RectangleGeometry
, as shown in the following code:package com.graphing { import away3d...