Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

XYZ-3d-graphing-utility

Archived legacy 3D graphing utility, originally written in 1998 using Turbo Pascal.

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

README

XYZ - 3D Graphing Utility

XYZ is a 3D graphing utility originally written in 1998 using Turbo Pascal. It was designed to render mathematical surfaces within a DOS environment.

Screenshot of XYZ 3D Graphing Utility

How it Works

XYZ achieves its 3D visualization through the coordination of three primary components:

  • Main Engine (XYZ.pas): Handles the user interface, the main rendering loop, and the final output to the screen.
  • RPN Library (RPN.pas): To maximize rendering speed, the utility converts standard mathematical equations into Reverse Polish Notation. This allows the program to evaluate the graph points rapidly using a stack-based approach, avoiding the overhead of repeated expression parsing.
  • Matrivex Library (Matrivex.pas): A custom matrix and vector math library that handles the heavy lifting of 3D linear algebra. This library is responsible for the 3D rotations and the perspective scaling that creates the illusion of depth.

Visuals & Rendering

The project utilizes a wireframe rendering style with a built-in perspective projection to create a sense of depth. To enhance the 3D effect, it employs depth-based shading:

  • Foreground: Objects closer to the viewer are rendered larger and in a lighter gray.
  • Background: Objects further away are rendered smaller and in a darker gray.

Technical Specifications

  • Language: Turbo Pascal
  • Environment: DOS
  • Input: Standard algebraic equations (converted to RPN internally)
  • Rendering: Wireframe with perspective projection and depth cueing (shading based on distance).
  • Key Components:
    • Matrivex: Custom library for 3D rotations and perspective projections.
    • RPN Evaluator: Custom implementation for high-speed equation processing.

[!IMPORTANT]

Developer's Note

This project was pushed to the limits of the Turbo Pascal memory model. Due to the recursive nature of the RPN evaluation and the complexity of the 3D rendering, the default stack sizes (8KB and 16KB) resulted in stack overflows. The code was ultimately configured to use the largest stack size permitted by the compiler to ensure stability.

Running the Code

Because this project was written for a DOS environment, you will likely need a legacy compiler or an emulator such as DOSBox to compile and run the source code on modern hardware. Once compiled, run the resulting XYZ.EXE from the DOS prompt.

Project History

This project was developed using Turbo Pascal around 1996-1998. It is preserved as an example of exploratory mathematical programming written in Pascal and is not under active development. It may require modifications to work with current compilers.

Successor Projects

4D Symbolic Function Graphing is the direct successor to XYZ - 3D Graphing Utility, as the fourth dimension was the next logical step. The original plan was to completely rewrite XYZ in Visual C++, using DirectX, in 4 dimensions, as a screensaver. However, I ran into complications with trying to design a more robust expression engine that could support symbolic manipulation and evaluation, which would be much more extensible than the RPN implementation in XYZ. I took a detour through the Smalltalk-80 programming language, writing this project first.

Then, the direct lineage continued after 4D Symbolic Function Graphing with Greenshift using everything I learned, and this was the C++ "screensaver" I planned to write, but by the time I started writing Greenshift, I had decided to pivot and create a Winamp visualization (which could theoretically still be used as a screensaver as a standalone .exe).

License

This project is licensed under the MIT License - see the LICENSE file for details.