Projective Geometry

Reverse of a Projection with AutoCAD

Данило Шеган (Duneelo Sheggun), 2004.

Given an AutoCAD drawing representing either orthogonal or central projection of an object in space, we want to reconstruct the object in 3 dimensions, in order to take advantage of viewing capabilities offered by JavaView.

The basic tool we're working with is AutoCAD. To employ benefits it offers, we're using AutoLisp to add features we need.

You may also take a look at the manual in Serbian.

Contents

Orthogonal projection Contents

We're provided with a drawing in orthogonal projection. To get original points from points in a drawing, we assume that the projection plane is coordinate plane Oxy (i.e. plane z=0). Then, we ask user to select a point, and enter elevation (which may be negative, and may be entered with the distance of two objects in the drawing).

With thus obtained data, we're able to construct a new point which represents original point in space based on the projection, using simple formulae: x=xc, y=yc, z=elevation.

Central projection Contents

In central projection with predetermined center of projection, points are determined with two variables: a projection, and a carrying plane or line. Further, carrying plane is determined with two straight lines: a trace line and vanishing line, both given in projective plane; carrying line is determined with two points: trace point and vanishing point, both of them in projective plane as well.

So, before asking user for a point in drawing, we ask her to select a trace (either point or line) and a vanishing point/line (depending on the type of trace). Next, we ask user to select all the points on this same carrier, so input would be as painless as possible.

To compute the positions of original points based on thus defined projections, we employ several techniques. First off, in case we're confronted with a point in plane, we reduce the problem to the problem of carrying lines by selecting a random point on a trace line, and use that as a trace point, and use intersection of a vanishing line and line through thus obtained point and projected point as a vanishing point.

Now, we basically need to find the intersection of projection ray through projected point and of a carrying line. To do that, we first make use of vanishing point to construct carrying line in space: we establish a line parallel to line through vanishing point and center of projection: a line through trace point and point given by center + (tracevanishing), and then obtain the intersection using AutoLisp inters function.

Choosing a center of projection

Traditional way of representing the center of projection is using its orthogonal projection, and distance circle. With already provided (very easy, which is important) way of getting a real point based on this data using reverse orthogonal projection, we thought it better to ask a user to select a real point in space as a center.

Caveats Contents

There're several caveats you need to watch for when using here provided code.

First, there's a problem in selecting a point as an entity (using entsel AutoLisp function) in AutoCAD when it resides on a line, or very near other object. I suggest you enlarge the appearance of the point in such cases, and select it by clicking on its outline.

Another problem is that JavaView doesn't display intersections of faces very nicely unless option "Enable Z Buffer" in Inspector > Display is turned on: it has a problem determining what is visible and what is not when viewed from some particular point. Using this option makes JavaView render images much slower.

Samples Contents

You can look at the following samples to see resulting output. Original drawings are taken from the collection maintained by Srđan Vukmirović.

Drawing file (.dwg) Generated .obj file Preview
JelenaJovicic-3d.dwg .OBJ file preview
dec034-3d.dwg .OBJ file preview

Download Contents

The resulting code is downloadable in a small archive as reverse-projection.zip. This is a Zip file, and to extract it, you may need additional software usually provided along with your operating system.

The above archives include a menu source file (menumatf.mns) and coresponding bitmaps which provide toolbar for working with new features.

Installation Contents

To install, extract the above downloaded archive and move contents of subdirectory Support to your AutoCAD Support directory (eg. "C:\Program Files\ACAD2000\Support").

If you already have automatic start-up file, acad.lsp, you may want to keep it, and add the following line to s::startup function:

(defun-q s::startup ()
  (load "normcent.lsp"))

Otherwise, just copy the one in archive over the one (if any) in your Support directory.

To load the toolbar, enter the following command in your AutoCAD console:

menuload

then browse to your Support directory, and select menumatf.mns file.


©2004 — Данило Шеган <danilo@kvota.net>