Introduction

This guide is intended to introduce you – user of program Descriptive geometry – with control of the program and with the programming language which you will use and with other features of program.
This guide is neither textbook of descriptive geometry, nor textbook of programming. We hope, you will be contended with this program and it will be useful for you.
If you have some remarks or questions, you can contact author.

Author’s address:
Petr Plavjanik
Heyrovskeho 974
Trebic
674 01
Czech Republic

http://dg.vidivici.cz/

Function of program

This program was created for ease solving tasks of descriptive geometry. Main principle is: user writes procedure (algorithm) and program makes drawing after this procedure. Procedure is written in programming language derived from language C. This language was modified to be suitable for solving of tasks of descriptive geometry.
There are many advantages contrary to hand drawing:

Technical information

The program was created with development environment of Borland Delphi 5 for Windows, which builds applications for Windows 95 and newer. Windows 95 or newer is required for running program Descriptive geometry. The main advantages of Windows for this program are: independence on used hardware (you can use this program on every graphics card and print on every printer compatible with Windows) and easy control (because is similar to other Windows apps).
Requirements are derived from requirements of Windows. Minimum system requirements: Pentium, 16 MB RAM. Installed program is smaller than two megabytes. It's a graphical program, so you need good monitor. Good is 15" or greater, recommended resolution is 1024x768.

Description of interface of program

Drawing Program Helpline Messages Object Inspector Editor Statusbar Toolbar Menu

Main window of program contains, like all Windows applications, menu bar and toolbar (which can be moved or hidden).
On the left side there is area with Drawing and on the right side there is text area for writing procedure (it's called Program). Below Program is Helpline, Message Window from program interpreter and Object Inspector. You can change sizes of areas according to your requirements.

Drawing

Drawing is result of program execution. It's drawn on paper. Size of paper can be changed in program (see section Drawing properties). You can it zoom in and out or move with it. Zoom commands are in menu Drawing and on toolbar Drawing.
During moving mouse pointer above Drawing are shown coordinates of this position in Helpline. If you have selected any point in Object Inspector, then in Helpline are also coordinates relative to this point. If you click on Drawing, then program generates code (to make point with this coordinates): point(x, y, 0). Use left button for groundplan, right button for frontplan; Ctrl for relative coordinates (A.1 + point(x, y, 0)).

Program

Program is to be written in editor with syntax highlighting. Its control is standard. Part of text can be selected, copied, inserted, cut. These commands are in menu Edit and on toolbar and there are hotkeys (Ctrl+X, C, V).
Other functions are Find and Replace.
Below this textbox is helpline with light-yellow color. His content depends on position of cursor in text. If the cursor is above a function, content is description of this function and its parameters. If the cursor is above a variable, then is variable highlighted in drawing and selected in Object Inspector.
There is popup menu (to show it press right mouse button in editor) with list of all functions. User-defined functions are marked with *. If you select an item in this list, the name of this function will be written into editor.
Other function of editor is Code Completion. Example: you write par, press Ctrl + spacebar and you see list of functions and variables beginning with par. You can select among them and then selected item will be written into editor,

Messages

In this list are messages from interpreter (error messages in case of any error) or messages from program (see function text). Every line has number of line in program related to message. You can select line in list and then the related line in editor will be selected.

Object Inspector

It's list of all variables (groups), which are sorted alphabetically or unsorted. After selection of any group is shown its description, program block and list of its objects. Objects in this list are numbered. There is number of line on which were objects created, special objects have there its value. After selection of object (group), the object (group) is highlighted in drawing. Double-clicking will write identifier (name and number) of object into editor.

Mouse Drawing

You can draw using mouse besides writing program, but it doesn't compensate writing program completely. Only some commands can be mouse-drawn, but you can modify it (file Lang\language.set) and you can add your functions.
List of all commands is on key Ctrl+H:

Mouse Drawing - Tree of commands

Double click will open window with parameters:
Mouse Drawing - Command parameters
At the top of windows is description of command, same is in the tree. Below is source code of command (from file Lang\language.set). In textbox Name is name of new object (name is chosen to be new). If you want, you can change it.
You needn't to press buttons with parameters, they are changed during input.
Types of parameters:
nameresultexampledescription
coordinates3 numbers5, 6, ?You can assign 3, 2 or 1 coordinate, while other are ?. During mouse-placing, select first X and Y in groundplan and then Z in frontplan. Buttons X, Y, Z set coordinates affected by moving of mouse.
numbernumber1.2Write number into textbox or as X coordinate on drawing.
distanceIt distance of mouse pointer (groundplan - button 1, frontplan - button 2) to some object assigned before. E. g. distance from center is radius of circle.
pointobject identifierA:2 or BIt's selected on drawing. It's projection (chosen by buttons 1, 2) of point immediate to pointer. Selected point is highlighted.
lineaSimilar to point
planePiIt's selected by track. Groundplan (Pi) and frontplan (Ny) are chosen by click on button with same name.
any objectoincluding conicsections
During moving of mouse on drawing, drawing is redrawn in case that all other parameters are assigned. After clicking is parameter assigned and it continues with next. If it was last, result code is inserted into program and program is executed.
Result code form: name = result_command;. If name is not assigned, then form is result_command.

Options

Dialog windows Options has several pages for every field of program:

Editor

Editor has syntax highlighting. Most of colors in editor can't be changed.
Another function is auto indent. New line will start where previous line starts. If previous line ends with {, next line starts two spaces farther. Command Small Drawing/Large Drawing (F3) changes sizes of Drawing and Editor. You can set proportions of that on this page.
There are also settings for Code Completion. You can set it on or off and set time of automatic opening.

Object Drawing

You can set here style of drawing geometric objects. This setting affects only objects not set with commands show, style, cut, color and divide. There can be chosen color of highlighting objects selected in Object Inspector.
Printers have higher resolution than screen, so lines on printed drawings are very thin. It can be improved by setting its width on this page.

Object Description

For object description are used three fonts: for normal description, for indexes and for Greek characters (name of objects is converted to Greek if in name are e. g.: alfa (small alfa a), Omega (big omega W), omega (small omega w)). You can set font and size in centimeters. There can be set maximal distance of description to object.

Paper

It's better to set this with functions margin and paper.

Number Format

Program Descriptive Geometry writes number in two cases: in Object Inspector and in Message Windows. In both cases number of all places and number of decimal places can be set.

Other

During executing long programs it's good to see progress of executing. It's displayed on information window which can be set on here.

Printing

It's possible to print program or drawing. These commands are in menu File. After pressing these command, standard print dialog is opened.
Settings of paper size made in window Printer setup are temporary. Permanent setting for each drawing can be made by command written in program (see section Work with program - Setting drawing properties).

Executing program

Written program can executed at once (Program - Run (F9)) or step-by-step (Program - Step / Pause (F8)). Command Step (F8) makes steps only in active program block; for trace into blocks under active use command Step in (Shift+F8). Drawing is redrawn only if it is necessary. Executing can be terminated by commandProgram - Halt (Ctrl+F2).
To stop program can be used DG-language function stop().
Executing with command Program - Run (F9) is smart, only new lines are executed. Command Program - Recompile (Ctrl+F9) forget old program and executes it again from beginning.
Executed program can be stepped by commandsProgram - Step forward (F7) and Step backward (F6).

Description of programming language

How it was mentioned, this language is similar to C, but it was modified to be better for descriptive geometry. This language is called DG-language in following text.
Program in DG-language is consisting of functions. There is one special function main, which is the first started function. Every program must contain this function.

Function declaration:
identifier ([parameter1[, parameter2... ]] ) {
[commands]
}

identifier can contain the letters a to z and A to Z, the underscore character _, and the digits 0 to 9. The first character must be a letter or an underscore.

Variables

Working with variables is different in DG-language. Variable is a group of objects. Group can contain no object, one object or more objects. Object is e. g. number, string, point, line, plane. In one group can be objects of various types.

a = 1; // creates new group a and adds one number-type object to the group
a = 2; // adds new object to the group

access to single objects in group: group:number
First object has number 0.

b = a:0 + a:1;addition of the first object in group with second
c = a + b;addition of group a (contains two number-type objects) and group b (contains one number), result c is group containing two numbers [a:0 + b:0, a:1 + b:0]
d = a + c;a and c contains both two objects, result is group containing four objects [a:0 + c:0, a:0 + c:1, a:1 + c:0, a:1 + c:1]

Use:

Statements

The basic components of every function are statements. DG-language has following statements: assignment, function call, compound statement, condition and cycle.
Statement is closed by semi-colon ;.

Assignment statement

Syntax:
left_group = right_group;

This statement adds to left_group objects in right_group. left_group must be named group, right_group can also be result of function or operations. So left_group is result of previous assignment statement or it is a new group which is created in this statement. a = 5; // creates new group with name a and adds an object to this group
a = 4; // add new object to existing group
The result of statement command is resultant group which can be used then:
c = b = 5; // adds object (5) into group b and adds into group c group b
c = (b = 5) + 1; // adds into b new object (5) and into group c group b added by 1.

Wrong:
c + 1 = 5; // left_group is not named, it was created during the statement
c:0 = 5; // it same as the previous line, use function rewrite
instead

Rewriting values

Syntax:
left_group := right_group;

Rewrites values of objects (not objects) in left_group with values in right_group. So this statement affects all group containing objects which are in left_group. If the count of objects in left_group is greater than in right_group, then are used objects in right_group from the beginning.
a = 1; a = 2; // creates group a containg two numbers
b = a; // b contains the same objects (not copies) as a
a:1 = 5; // second number is changed to 5, so a is [1, 5] and b is [1, 5] too

Compound statement

Syntax:
{
statements;
}

or { statements; }

Compound statment is used as one statement in cycles and conditions.

Condition

Syntax:
if (logical_expresion) statement1;
if (logical_expresion) statement1; else statement2;

logical_expresion - it is a group. Condition will be evaluated for every number in this group. If the number is not equals 0, then will be executed statement1, else will be executed nothing (variant without else) or statement2 (variant with else).
Statement is single statement or compound statement.

Cycle

Syntax:
while (logical_expresion) statement;

statement is repeated while the condition defined by logical_expresion is true.
Its suitable to use statement := (rewrite command) and functions rewrite, inc, dec.
Example:
i = 1;
while (i <= 5) {
  ...
  inc(i);             // +1
  inc(i, 2);          // +2
  dec(i);             // -1
  rewrite(i, i+0.5);  // +0.5 
  i := i + 3;         // +3
}

Attention: statement i = i + 1 don't increase 1 by 1, but adds to the group number i increased by 1.

Function in DG-language

There are two types of functions:
  1. returning result (group) which can be used in statement or expression
  2. returning no result. It's compound statement with name and parameters
Calling functions:
function_identifier ([parameter1[, parameter2...]])

If the function don't expect parameters, there still must be (), because () differentiate function from variable (function and group with the same name can exist).

Function declaration:
function_identifier ([[*]parameter1[,[*] parameter2...]]) {
[statements]
}

If you want function to return a result, function must contain statement return which sets result and terminates function.
Syntax of statement return:
return group;
This statement can be in function several times (e.g. in conditions), but is executed most one times, because function is terminated after its execution.
If this statement isn't executed (function isn't containing it, or is in the condition-statement which isn't executed), function has no result and this function can't be used in expression, but can be used as single statement.
In function can be used all groups defined in calling function. But assignment statement don't add to such groups and creates new group visible in only this function.
Character * before identifier means that this parameter won't be value parameter, but variable parameter. All changes made to this group are changes to parameter too. Variable parameters must be groups, not expressions.

Working with groups

rewriterewrites group or object in group by another object
rewrite(group1, group2)clears group1 and adds to it objects from group2
delete(group)deletes group; if objects belongs to other group, they aren't destroyed
m(object1, object2, ...)creates group containing these objects
[object1, object2, ...]creates group containing these objects

Comments

Comment (remark) is the part of source code which is ignored by interpreter. It's used to remark some part of program or to disable part of program.
In DG-language there are two types of comments. The first is comment written as // and then the rest of line after // is ignored. Other lines aren't affected.
The second type is block comment. It begins with /* and ends with */.

Object number

This objects contains one real number. Number is written as decimal.

Operators

syntaxdescription
a + baddition
a - bsubtraction
-aunary minus
a * bmultiplication
a / bdivision
a % bmodulo, remainder after division (using integer parts of numbers)
a ^ bpower
a == bequality
a != binequality
a <> b
a < blower than
a > bgreater than
a <= blower or equals than
a >= bgreater or equals than
a..bcreates group containing cardinal numbers from a to b including
inc(a, b)increases number a by b
inc(a)increases number a by 1
dec(a, b)decreases number a by b
dec(a)decreases number a by 1

Functions inc and dec returns changed group.

Logical expressions

Logical expressions are expressed in DG-language by means of numbers. True is every number different from 0, false is 0. You can use these logical operations:
&logical and
|logical or
!not, negation (unary operation)

Mathematical functions

pwr, rdx power and radix, one parameter, then it is square power and square root, two parameters, the first is number, the second is exponent
sin, cos, tan, cotan 
sinh, cosh, tanh 
arcsin, arccos, arctan 
arcsinh, arccosh, arctanh 
log10, log2, ln, exp 
randomgenerates random number
degconversion radians to degrees
radconversion degrees to radians

Last two functions are important for input of angles. All functions requires angle in radians and all functions returns angle in radians. If you want write angle in degrees as parameter, write: function(..., rad(angle_in_degrees), .... To convert result to degrees use: deg(function(...).

Object string

This object is used to write messages, getting object properties and its types. String is written between quotation marks: "any text".
a + bconcating
a == bcomparing
a != b
a <> b
text + numberconversion number to text and concating



Points and vectors are main objects of analytic geometry. When we are drawing with ruler and compasses, we needn't compute vectors. But for computer it's the only way how represent geometric objects.
Every point and vector in space has three coordinates: (x, y, z). Every coordinate is real number.

Object vector

Vector is defined by three coordinates or two coordinates (then z = 0) or point whose coordinates are used as coordinates of vector.
u + vsum of vectors (addition of coordinates)
u - vdifference
u * vscalar product
u * numbermultiple of vector
u / numbervector division (coordinates divided by number)
u # vvector product
-uopposite vector
u == vequality
u != vinequality
u <> vinequality
v(u)size of vector
par(u, v)parallelism (result is logical expression)
def(u, v)deflection of vectors
u."x"result is one coordinate
u."y"
u."z"
u.1projection of vector to groundplan - 1, frontplan - 2, sideplan - 3
u.2
u.3

Object point

Assignment is similar to vector (3 or 2 coordinates or vector). But point is main geometric object and other objects are defined with point. Every point can be drawed and descripted on drawing.

A + Bsum of points
A - Bdifference
A * numbermultiple of point
A / numberdivision of point
A == Bequality
A != Binequality
A <> Binequality
on(object, A)points lies on object (line, plane, conicsection)
in(object, A)intersection of point and object, if intersection is empty, result is object of type null
A + vectormoves point A
move(A, vector)
A."x"result is one coordinate
A."y"
A."z"
A.1projection of point to groundplan - 1, frontplan - 2, sideplan - 3
A.2
A.3

Point can be also defined in plane, plane and two coordinates are requided.
point(plane, x, y, z) one coordinate can be free (?)
e.g.: point(ro, 5, 6, ?)
Another type of assignment is point lying on line in distance to other point.
point(line, point, distance)

Object line

Types of assignment: line(point1, point2)
line(point, vector)
line(line1, line2) groundplan, frontplan
line(plane, line, point, angle)
You can also define semiline and abscissa
semiline(...)
abscissa(...)
Parameters are same.
a == bidentity, it doesn't differentiate line from abscissa and semiline
a + BB is point, moves line by coordinates of point
a - Breverse moving
a + uu is vector, moves line by vector
a - u
a."A"first point of line
a."B"second point
a."v"vector of line
a.1projection of point to groundplan - 1, frontplan - 2, sideplan - 3, result is line or point
a.2
a.3

Object plane

Plane can be defined by:
  1. three points (not on same line) - plane(A, B, C)
  2. line and point (not on this line) - plane(a, B)
  3. two different lines - plane(a, b)
  4. plane(x, y, z), number x (y, z) is intersect of plane and axis x (y, z)
  5. plane(a, b, c, d) - equation: ax + by + cz + d = 0
Ro == Sigmaidentity of two planes
Ro.1tracks of plane, its intersection of plane and 1 - grounplan, 2 - frontplan, 3 - sideplan
Ro.2
Ro.3
Ro."v"vector of plane
Ro."a"coefficients in equation
Ro."b"
Ro."c"
Ro."d"

Conicsections

The drawing of conicsections (circle, ellipse, hyperbola and parabola) is difficult and so we must draw by our hands only with approximate methods. The advantages of this program is in this field are shown more than in drawing simpler objects.
The internal form of every conicsection is analytic. Conicsection must lie in groundplan or frontplan and in planes parallel with them. The style of drawing has same properties as other objects (line width, line style, color, cutting to parts...).
Special is circle which can lie in every plane and it isn't represented by equation, but by plane, center and radius. It is converted to conicsection in the time of drawing (the projection of circle is ellipse).
Ways of entering conicsections: circle(plane, center, radius)
ellipse(plane, F, G, a) - plane must be parallel to groundplan or frontplan, F and G are focal points, a is length of main axis
ellipse(plane, A, S, C) - A primary vertex, S secondary vertex, C center
hyperbola(plane, F, G, a)
parabola(plane, F, d) - focal point F and directix d

Every conicsection can be entered by this ways.
In the unit "conicsections.dk" you can find functions to construction of tangents to ellipse and hyperbola. More in this unit.

Function p(object, object) can be used to get intersection of two conicsections, conicsection with line or plane. Other functions are test of lying a point on conicsection, moving and rotating

You can get the center of the conicsection with center (circle, ellipse and hyperbola) by operator . and property "S".
S = k."S"

Other properties:
"ro"plane where conicsection lies
"typ"type of conicsection: ellipse, hyperbola, parabola
"u"deflection of axis
"DD", "dd"discriminant of conicsection and discriminant of quadratic terms
"a11" - "a33"coefficients in equation
for ellipse and hyperbola:
"F", "G"focal points
"A", "B"main vertices
"C", "D"secondary vertices
"h", "v"main and secondary axis
"a", "b", "e" half size of main and secondary axis, excentrity
for parabola:
"F"focal point
"d", "v"directix, vertex tangent
"V"vertex
"p"parameter
"o"axis

Conicsection can be moved or rotated, result is transformed conicsection:
f = move(e, vector(2, 5, 6));
r = rotate(p, radians(45));
Examples:

conicsection defined by equation in groundplan:
c = conicsection(Pi, 9, 24, -18, 2, -12, 21);
circle:
Ro = plane(5, 7, 8);
S = point(Ro, -4, 3, ?);
k = circle(Ro, S, 4);
ellipse, hyperbola and parabola:
e = ellipse(Pi, F, G, 5);
h = hyperbola(Ny, F, G, 6);
p = parabola(Pi, F, d, p);
Unit "conicsections.dk" contains Rytz's construction and many others.

Working with program

Setting Drawing Properties

Before writing of program it should be clear what size of paper will be and what orientation (portrait or landscape) will have the paper. You can also set the margins or border line around the drawing.
It can be set in two ways:
  1. In window Printer setup and Options window. This setting is active not only for actual program but also for other.
  2. Settings are written into program. This setting will be active when program is executed.
The second way is better because different drawings have different settings.

paper(height, width, orientation [, scale factor])
height and width is size of paper in centimeters, orientation can be either 1 (portrait), or 2 (landscape).

margin(top, bottom, left, right, inner, line_width, line_style)
size of margins is in centimeters, inner border is width of area from border line to inside on which aren't drawn objects. line_width can be from 0 above. line_style: 0 - solid, 1 - - -- -, 2 - - . - . - . - ., 3 - ........... 4 - -..-..-..-..-.

Choosing Projection

Basic and default projection in this program is Monge's projection. Other projections are dimensioned and view of groundplan without dimensions (it's normal paper). In further versions will be implemented other projections.
projection("monge")	// sets Monge's projection
projection("dimensioned")
projection("paper")
You can also set the position of origin point on the paper by command moveO(x, y).
moveO(2, -2) // moves origin two centimeters upwards and right.

Using units

In longer programs are repeating parts. It isn't necessary to write them more then once, you can write a function and then write only one command.
Some functions are useful not only for one program, it's advisable to place such functions to special file - unit - that can be used from every program. If you want use unit from current program:
#include "file_with_unit.dk".
How looks unit: unit doesn't contains function with name main, but contains other functions that can be used in other programs or units. It's wrong when one program includes two units in which are two function with same name.

Style of object drawing

Style of drawing of geometric objects -- size, width, color, style of lines and point -- is important for the lucidity of drawing.
You can set it:
  1. for all objects and drawings in Options window
  2. for selected objects with functions written into program
Type of drawing can be different in groundplan and frontplan, even parts of object can have different settings.

show(object, [part,] plan, visibility, [[point_size, point_style], line_width, line_style])
plan1 - groundplan, 2 - frontplan, all - both
partthe part of object that will by set, default is first part, identifier all can be used
visibility0 - invisible, 1 - visible only in positive part of coordinate system, 2 - always visible, 3 - negative part
point_size and point_style are not only for points but also for lines when is line projected as a point. To keep these values without changes, write instead a number ?
point_style(in cm) it's diameter of point size, 0 is size of one pixel; -1 is invisibility
point_style0 - cross +, 1 - transparent circle, 2 - white circle ¡, 3 - coloredl
line_width size of line in pixels
line_style 0 - solid, 1 - - - - - - -, 2 - -.-.-.-.-.-, 3 - ..........., 4 - -..-..-..-..-.

color(object, [part,] [plan, ] name_of_color/number_of_color)
name_of_colorname of color: "black", "white" , "blue" , "green" , "red" , "yellow" , "gray"
number_of_coloruse function RGB(r, g, b) to get this number

You can cut objects into several parts. Cutting is done by lines that delimit visible area. Every line enter by two points defines the half-plane. If you want opposite half-plane, enter points in inverse order. You can enter one condition by function cut, other conditions by other lines with functioncut.
cut(object, [part,] plan, A, B, sign)
partthe number of part
A, Bpoints defining line and half-plane
signchanges meaning of all conditions, 1 - cutting according conditions, 0 - inverse

Functions show, color and cut set various types and styles of drawing but they are complicated. Frequent action is cutting of line (or conicsection) into several parts according the points lying on it. Type of drawing changes regular on this parts. It's used for setting of visibility (visible and invisible parts change).
divide(object, plan, line_width1, line_style1, line_width2, line_style2, point1, point2, …)
line_width1, line_style1type of drawing odd parts
line_width2, line_style2even parts
point1, point2, …dividing points
Points must be entered in order as lie on the line! Function sortpol(line, points…) orders points to this order.
If you are dividing a conicsection you can set which part of curve between two points is used (write 1 between points to use longer part, default is shorter).

Object Description

Every visible object is described by conventional rules. Every object is described by its identifier and its number in primary group. This number is superscript. If number of objects in group is lower than four, there are lined indexes instead of numbers. First object is without index. Font and size can be set in Options Window.
In case that more objects are drawn into same place it expresses in description, e.g. A=B=C.
Description can't overlap other descriptions or points. If it is possible description doesn't overlap lines. If the place for description is to far from original point is description drawn over lines.
Differences in description in various projections:
Description of objects can be set by function descript(object, plan, visibility, [other description]).
objectobject to be set
plan1 = groundplan, 2 = frontplan, all = both
visibilitysets if the description is visible; 0 = no, 1 = automatic, 2 = always
other descriptionoptional parameter; description is made by above-mentioned rules, if you want alternative you can set it there. These variables can be used: #^ = original superscript, #_ = subscript, #( = dimension, #N = object identifier; and commands: ^text = superscript (format), _text = subscript, \btext = bold, \itext = italics, where text is one character or {more characters}.

There is one more possibility how to draw text on the drawing:
caption(point, text, fontname, height of text in cm, position (0 = fixed, 1 = floating (like description))).
Parameter text is caption to be written onto the drawing. It can contain same commands as a description. In this caption aren't converted Greek characters (e.g. alfa to alfa in Greek font). If want to use Greek character write @x where x is character to be written in Greek font.

Pictures in formats BMP, WMF and EMF can be drawn on the drawing:
image(left upper point, right bottom point, file with image, position (0 = fixed, 1 = floating).
Picture will be stretched between ground projections of points. Order of drawing of picture depends on position of function image in program.

Constructions

Constructions are function which makes from several input object (parameters) object that is result of this construction.

Point lying in plane

Point can be enter by plane and two coordinates, third is calculated (if is it possible).
point(plane, x, y, ?) or point(plane, x, ?, z) or point(plane, ?, y, z)

Parallel and vertical lines

line parallel with other line trough a pointparline(line, point)
line in plane parallel with a line in a distance from this lineparline(plane, line, distance)
line in plane vertical to other line trough a pointverline(plane, line, point)
line vertical to a line trough a pointverline(line, point)
line vertical to a plane trough a pointverline(plane, point)

Parallel and vertical planes

plane parallel to other plane trough a pointparplane(plane, point)
plane parallel to a line trough a pointverplane(plane, point)

Falling and revolution (?)

These two construction are very used in highschool descriptive geometry (in Czech Republic).
They can be programmed using other constructions in DG (see unit monge_sklop.dk). But they are in DG internally in order to be faster.
Functions are: revol, revolback, revol2, revolback2. (back means backwards, 2 is frontplan)
Functions revol and revol2 have two parameters: group of points a horizontal line of planeround that will be points revolved. Result is group of revolved objects.
Functions revolback and revolback2 are opposite to the first two: point in ground(front)plan revolve back into plane. Parameters are: group to be revolved, plane and horizontal line of this plane.

Functions for falling are similar: fall, fall2, lift, lift2.
These functions have two parameters: point to be fell (or lifted) and line around that is point falls.

Intersection

in(object1, object2)
Function in works for all basic objects (point, line, plane, conicsection). Order of object depends on their type: conicsection is first, plane, line, point is last. Result is group of objects. In case of no intersection is result special type null.

Polygon

Polygon is enter by three or more points. Result is group of lines.
polygon(point1, point2, …, pointn)creates group of abscissas (first from point1 to point2, second from point2 to point3, the last from pointn to point1).

Point-by-point construction

Solution of more complicated problems (e. g. intersection of two objects) is not simple curve. We only know how to create points lying on it. Then we can join the points into continuous curve. There is problem in order of points. They aren't usually in order as are they on paper. So we can't use function polygon to join them. Before we must order them into correct order. There are three cases:
  1. If result of every step is only one point, are points usually in correct order (you can check it in Object Inspector) a they can be joined by function polygon or polyline.

  2. Result of step are two or more points. They aren't in correct order, but they can be reordered into it. For example first of two point belongs to first part of curve, second point to second part. In this case you must know how are points created and according to it reorder them. It can be done by some cycles:
    // even in original order
    i = 0;
    while (i < count(R)) {
      NR = R:i;
      inc(i, 2);
    }
    delete(i);
    // odd in reverse order
    i = count(R)-1;
    while (i >= 0) {
      NR = R:i;
      dec(i, 2);
    }
    delete(i);
    
    For easier reorder there are some function for it:
    order(number_of_parts, [-]part1, [-]part2, …, points…)
    number_of_parts it's number of points from one step, it's number of parts of curve
    part number of first (second...) partí, if is negative, the points from this part are reversed
    points one or more groups with points

  3. If you aren't able to order points, you can use functions points, pointsc, points2 or pointsc2. These functions joins closest points.
    points(point1, point2, …, pointn) creates group of lines from points
    pointsc first and last point are connected
    points2, pointsc2 for frontplan

Example:
It's a way how to do point-by-point construction using one while-cycle. In this case the height is changing and for every height is made the same function.
one_step (z) {
  . . .			// some procedure
  return X;		// X is result point
}

z = 0.5;		// initial height
st = 0.1;		// step in cm, lower number, greater precision, but longer while

while (z <= 4.5) {	// cycle is limited by maximal height
    R = one_step(z);		// one step
    z := z + st;		// increasing of height
}

Accroding to above-mentioned cases:

    1. Points are joined into one curve by function polygon
    cR = polygon(R); or cR = polyline(R);

    2. Group of points consists of two interlocking parts. So we order them by function order:
    NR = order(2, 1, -2, R);
    cR = polygon(NR); ir cR = polyline(NR);

    3. Group R contains many points, we join them by function pointsc:
    cR = pointsc(R); // groundplan
    cR2 = pointsc2(R); // frontplan

For every case:

show(R, all, 0);		// original points will be invisible
show(cR, 1, 1, 1, 0, 0, 2, 0);	// positive part thicker
show(cR, 2, 1, 3, 0, 0, 1, 3);	// negative part ......

Analytic Geometry

Program DG contains functions for analytic geometry. They can be divided into two groups:
  1. ascertainable on paper by one measurement by ruler or pair of compasses
  2. to ascertain them you must do some steps
For program DG are both groups the same, but not if you are drawing by hand on paper.
Using functions for second group is easier and faster than writing longer procedure into your program.

Size

s(vector) size of vector

Distance

Result is distance between two objects.
s(point, point) distance between two points
s(line, point) distance between point and line
s(plane, point) distance between point and plane

Parallelism

Result is a logical value.
par(line, line) are lines parallel?
par(plane, line) is plane and line parallel?
par(plane, plane) are planes parallel?
par(vector, vector) are vector parallel?

Perpendicularity

Perpendicularity is deflection by 90° (pi/2 radians).

Deflection

Result is angle in radians.
def(line, line)
def(plane, line)
def(plane, plane)
def(vector, vector)

Fillng areas

To fill an area you must enter boundary curves and inner point.
There are two functions fill and fill2. The first one predraws all curves in solid style, but the second in their style. This predrawing is not visible.
Syntax: fill[2](point, plan, color, fill_style, boundary)
If you want enter more points, use group: fill([A, B], 1, RGB(100, 200, 50), 0, [a, b, c]);
fill_style 0 - solid, 1 - 6 various types. Fills are in folder Fills, you can modify them, they are in two resolutions (lower for display, greater for printer).

Other projections

In program Descriptive Geometry are built-in two projection methods of three-dimensional objects: dimensioned projection and Monge's projection. So you can make directly drawing in other projections, but you can do it in the same way as you draw on paper. Set projection("paper"). If you want draw a point for example in axonometry you can't write point(x, y, z), but use function that creates point in this projection.
Some functions for axonometry are in unit "axonometrie.dk" and examples uning it. Before drawing in axonometry is important to set the axonometry: size of axonometric triangle, axes; these setting are used by other functions. Function abod(x, y, z) creates two points: axonometric projection and ground projection of the point. There are other functions, but don't understant that this unit can everything -- it's only an example how extend the program at the user's level.


Updated: 6. 8. 2000