C.a.R. > Documentation > File Format

File Format of C.a.R.

Introduction

C.a.R. uses the standard XML to store constructions. This format can be easily read by humans, and even edited without the C.a.R. program.

If you use compression to store files, you will not be able to read these files. Compression is done by standard compression methods in Java. The files can be decompressed with gzip.

XML files can be edited by many programs. To save the files, you can use either UTF-8 encoding or ISO-8869-1, which is the usual Windows encoding, and the default, if the encoding is not explicitly mentioned. The Microsoft Internet Explorer can display XML too, if they have the extension XML.

The structure

The general structure may be seen from the following example.

<?xml version="1.0" encoding="utf-8"?>
<CaR>
<Construction>
<Window x="0.0" y="0.0" w="8.0"/>
<Comment>
<P>Constructs the perpendicular bisector for the segment
through the two points.</P>
</Comment>
<Objects>
<Point name="P1" x="-3.9940740740740743" y="-1.1259259259259267">Point at -3.9940740740740743, -1.1259259259259267</Point>
<Point name="P2" x="1.53" y="1.17">Point at 1.53, 1.17</Point>
<Circle name="c1" through="P2" midpoint="P1" acute="true">Circle around P1 through P2</Circle>
<Circle name="c2" through="P1" midpoint="P2" acute="true">Circle around P2 through P1</Circle>
<Intersection name="I2" first="c1" second="c2" which="second">Intersection between c1 and c2</Intersection>
<Intersection name="I3" first="c1" second="c2" which="first">Intersection between c1 and c2</Intersection>
<Line name="l1" from="I2" to="I3">Line through I2 and I3</Line>
</Objects>
</Construction>
</CaR>

The file consists of tags like

<Objects>
...
</Objects>

Every tag has a start and an end, and a content in between. If there is no content, the following syntax may be used.

<Window .../>

Moreover, the start may have parameters.

<Point name="Punkt 1" x="-0.4036697247706422" y="-0.05504587155963303">Punkt in -0.4036697247706422, -0.05504587155963303</Point>

There are other special tags, which describe the XML file itself. The first line must be

<?xml version="1.0" encoding="utf-8"?>

or

<?xml version="1.0" encoding="iso-8859-1"?>

The version and the encoding can be omitted, if the file is for C.a.R.

This is a first self made example.

<?xml?>
<CaR>
<Construction>
<Window x=0 y=0 w=5/>
<Comment>
<P>Construction of a perpendicular on the middle of a line!</P>
</Comment>
<Objects>
<Point name=P x=-1 y=0/>
<Point name=Q x=1 y=0/>
<Circle name=k1 midpoint=P through=Q hidden/>
<Circle name=k2 midpoint=Q through=P hidden/>
<Intersection name=A first=k1 second=k2 other=B hidden/>
<OtherIntersection name=B hidden/>
<Line name=g from=A to=B/>
</Objects>
</Construction>
</CaR>

The Window tag describes the center of the display and its width.

This file cannot be read by Internet Explorer, since it expects the parameters in quotes "".

Frame tags

 

CaR

Must embrace the file.

Construction

Embraces a construction. The job parameter will identify an assignment. The value of this parameter does not matter, but should be "true". For each job, there must be the parameters last and target which define the last object to be displayed and the target of the assignment.

Window

Sets the viewport. Parameters are x, y, and w, the center and the screen width.

Comment

Contains the comment. It consists of either a sequence of paragraphs (each like <P>...</P>), or a single paragraph.

Assignment

Comment to display the assignment.

Objects

The construction. See below.

Macro

Similar to Objects. See below.

 

 

Construction Elements

 

Point

x=0 y=0

A point in (x,y).

Line

from=A to=B

The line AB.

Segment

from=A to=B

The segment AB.

Ray

from=A to=B

The ray from A through B.

Circle

midpoint=M through=P

The circle around M through P. If throuhg is missing you must provide fixed.

Circle3

midpoint=M from=A to=B

The circle around M with radius AB.

Intersection

first=X second=Y other=B

The intersection of X and Y. B is the name of the other intersection point.

OtherIntersection

 

Describes the properties of the other intersection points. May be missing.

Parallel

point=A line=g

The parallel to g through A.

Plumb

point=A line=g

The perpendicular to g through A.

Angle

first=A root=B second=C

The angle ABC.

 

 

These objects can have further parameters.

 

name

The name of the object.

color

One of the numbers 0,1,2,3. The number 0 means black.

type

One of the values thick, thin or normal.

showname

If this is defined, the name will be displayed.

showvalue

Displays the value.

hidden

Hides the object.

fixed

Fixes the object size to the value. Points use the value true, since the coordinates are fixed in this case

partial

Displays circles and lines partially.

away

Only for intersections. See the description of intersections in the documentation

 

C.a.R. > Documentation > File Format