AlgoSim
Homepage | Screenshots | Gallery of Visualisation | User's Guide | Function Reference | Download | FAQ | Support | Bugs and Solutions | Donate

Reference: createGraph3

createGraph3(expr, vars, set) creates the three-dimensional graph { (x, y, z) ∈ R^3: (x, y, z) = (x, y, expr(x, y)), (x, y) ∈ set } of expr, a string representing a real-valued expression in two variables, listed in vars, a comma-separated string of valid identifiers, where the independent variables, as a vector ❨x, y❩, take on each value in set, a set of planar vectors.

Examples: surf ≔ createGraph3("sin(sqrt(x^2 + y^2))", "x, y", [-10, 10, 0.1]^2)
          drawSet("surf")

Important Remark: In most cases, createSurfParamCurves and drawSurfParamCurves are much more efficient and visually pleasing than createGraph3/createImage and drawSet3.

createGraph3 and drawSet3 draws a surface as a uniform point set, that is, to make a dense surface you need as many points as required by the screen resolution, which takes very long time to compute. In addition, because this is a mere point set and not a true 3D surface, realistic lightning is not applied, and so it might be difficult to view the surface.

createNet, createImage, and drawSet3 partly resolve this problem. Using createNet, you can create a grid in the parameter plane of the surface, and then apply createImage to these parameter lines instead. When drawn using drawSet3, only the parameter curves (at some distance and resolution) are drawn, thus greatly simplifying the interpretation of the resulting image. In addition, only a small fraction of the points required by the naïve approach (createGraph3 and drawSet3) are required. (Indeed, we only draw the surface's parameter curves, not the entire surface.) However, the parameter curves are drawn by simply plotting points of them, and so this method is as insufficient as drawSet as compared to drawLines when drawing a 2D curve (or drawSet3 as compared to drawLines3).

To draw a surface parameter curves using polyline approximation (usually not even a visible loss in quality, but extremely fast), use createSurfParamCurves and drawSurfParamCurves instead.