Article View: comp.lang.pascal.delphi.misc
Article #143"Movies", "3D Lab" examples of using TPantograph object in 2D/3D graphics library
From: Earl F. Glynn
Date: Sat, 13 Dec 1997 00:00
Date: Sat, 13 Dec 1997 00:00
92 lines
4547 bytes
4547 bytes
I've added two new examples of using my TPantograph non-visual object in my freeware 2D/3D graphics library. This library is intended mostly for use with floating-point calculations. You can work directly with world coordinates instead of pixel coordinates. I don't have a web site, but I'll E-mail anyone interested in these updates. You'll only get Delphi 3 source (~50K zipped) unless you ask specifically for the EXEs (~560K zipped). Here's the Readme file that has more information: Delphi 3 2D/3D Graphics Libraries and Examples for Scientific/Engineering/Mathematical Applications by Earl F. Glynn EarlGlynn@WorldNet.att.net Overland Park, KS 66214 Copyright (C) 1997, Earl F. Glynn. All Rights Reserved. May be used freely for non-commercial use. These libraries and examples were tested in Delphi 3. They worked in Delphi 1 and 2 before re-compiling in Delphi 3. LIBRARIES Graphics Math Library (GraphicsMath.PAS) This unit should be understandable by a person that knows matrix math and 2D/3D geometry. A standard college-level book on computer graphics can supply the background on the various 2D/3D transformations. Graphics Primitives Library (GraphicsPrimitives.PAS) This unit defines a non-visual TPantograph object used for mapping world coordinates (Doubles) to a canvas, which can be any canvas: screen, printer, or in-memory. 2D/3D vectors can be defined and manipulated. These vectors can be scaled, rotated and translated. A ViewTransformMatrix can be used to map 3D coordinates to a 2D plane. A default transformation matrix can be established (often a View TransformMatrix) so you can work in world coordinates. Multiple viewports can be defined on a logical window. Clipping to each viewport is possible. Figure Drawing Library (DrawFigures.PAS) A library shared by the example programs below for drawing spheres, cubes, a mathematical surface z = f(x,y), and a football field (American). EXAMPLE PROGRAMS The first two example programs have not changed much from the past. The third and fourth examples are new and show more interactivity. Example 1 (Football.EXE) This example shows three perspective views and an orthographic view of the KSU football field. You can display these four views on the screen or print them out. Example 2 (Spheres.EXE) This example shows six perspective views and three orthographic views of a sphere inside a cube. You can display these views on the screen or print them out. A "dynamic" checkbox allows one to view the drawing of each line segment. Example 3 (SphereMovie.EXE) Generate a "movie" (50 frames by default) to show a "fly around" of a sphere in a cube. (An alternate interpretation is the camera is fixed and the sphere moves around.) These frames are a TList of in-memory bitmaps that are then displayed as quickly as possible for the animation. If you increase the number of frames generated, you can use this program as a stress test of your real/virtual memory. Replay the sequence or use a scroll bar to view the images. Sometimes playback times are improved by playing several times. (I'd appreciate any help in creating an AVI file from this TList of bitmaps.) Example 4 (ThreeDLab.EXE) The "3D Lab". Choose a figure to display (Cube | Sphere | Cube & Sphere | f(x,y) Surface | Football field) and then use spinboxes to decide where your eye is. Hold down on the spinboxes (assuming you have enough spare cycles -- it works fine on a 166 MHz Pentium with 32 MB memory) to see the figure rotate left-or-right or up-or-down, or change the viewing distance. efg _________________________________________________ Earl F. Glynn EarlGlynn@WorldNet.att.net MedTech Research Corporation Lenexa, KS 66219 USA
Technical Details
Message-ID:
<66ulef$jnf@bgtnsc02.worldnet.att.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10a296,3a559e4762318d2e,start X-Google-Attributes: gid10a296,public X-Google-Thread: f973d,3a559e4762318d2e,start X-Google-Attributes: gidf973d,public X-Google-Thread: 10baee,3a559e4762318d2e,start X-Google-Attributes: gid10baee,public From: "Earl F. Glynn" <EarlGlynn@WorldNet.att.net> Subject: "Movies", "3D Lab" examples of using TPantograph object in 2D/3D graphics library Date: 1997/12/13 Message-ID: <66ulef$jnf@bgtnsc02.worldnet.att.net> X-Deja-AN: 297898484 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: AT&T WorldNet Services Newsgroups: comp.lang.pascal.delphi.misc,alt.lang.delphi,borland.public.delphi.graphics