# Definition of an exercise ruler & compass.
# syntax of the file.
# points:  each line defines a point.  x,y
# lines:   each line defines two points on a line.   x1,y1,x2,y2,type
#          type: 1 (segment), 2 (line), 3 (semiline direct), 4 (semiline inverse)
#	   type is facultative, defaulting to 1.
# circles: each line defines a circle. x,y,r,n
#	   where (x,y) is the center, r=radius,
#          n is the number of point for the center (if n>0).
# goal: each line defines an object. First item is the type of the object
# (point,line or circle), the rest are parameters (same as above).
# goal_text: text explaining the goal. (language-dependent)

title=Punto equidistante su di una retta
boundary=circles

a=!random 0,2*pi
b=!random 0.2,1.2
t=!random -0.75,0.75
cosa=$[cos($a)]
sina=$[sin($a)]
cosab=$[cos($a+$b)]
sinab=$[sin($a+$b)]
shiftx=$[$t*($cosa)]
shifty=$[$t*($sina)]

points=$cosa,$sina\
-($cosa),-($sina)
lines=$cosab+($shiftx),$sinab+($shifty),-($cosab)+($shiftx),-($sinab)+($shifty),2

a1=($cosa*2)
b1=($sina*2)
c1=0
a2=($sinab*2)
b2=(-($cosab)*2)
c2=(2*($shiftx)*($sinab)-2*($shifty)*($cosab))
det=(($a1)*($b2)-($a2)*($b1))

goal=point,(-$b1*$c2)/$det,($a1*$c2)/$det
goal_text=trovare il punto sulla retta 1 equidistante dai punti 1 e 2

solution=circle,1,2\
circle,2,1\
point,circle,1,circle,2\
line,3,4\
point,line,1,line,2\
hide,circle,1\
hide,circle,2\
hide,point,3\
hide,point,4

hint=

