DMelt:Plots/Interactive Geometry

From HandWiki
Member


Interactive geometry

For drawing iterative geometrical objects, use the class HZirkel which is re-write of the well-known C.a.R/Zirkel HZirkel (Compass and Ruler Construct and Rule) project. DataMelt uses a Swing-rewrite of this program called CarMetal. The source code has several modifications in order to run this program using a scripting language.

This is a small example of how to manipulate with geometrical objects from the package "carmetal.objects".

from jhplot import *
from carmetal.objects import PointObject,LineObject,CircleObject

c1=HZirkel(600,600)
C=c1.getConstruction()
c1.setAxis(1)

# draw a point
p1=PointObject(C,1.0,1.0)
c1.draw(p1)

# draw a line
p1=LineObject(C,PointObject(C,-3,3), PointObject(C,3.0,-3.0), )
c1.draw(p1)

# draw a circle
p1=CircleObject(C,PointObject(C,0,0), PointObject(C,3.0,-3.0), )
c1.draw(p1)

The output is shown below:

DMelt example: A dynamic geometry program