<!-- This example ilustrates the locus_defined_by_point_on_locus constraint
As P moves over the circle of center (0,0) and radius 1, X2 rotates 4 times around A2

PSEUDO-WIRIS code:
	t = 0.3
	C1 = point(0,0)
	C2 = point(-2,0)
	A1 = point(-3,0)
	A2 = point(-5,0)

	P := point(cos t, sin t)
	r1 := line(C1,P)
	t1 := perpendicular(r1,P)
	l1 := perpendicular(t1,A1)
	x1 := intersect(t1,l1)
	X1 := x1.1                          # first locus
	r2 := line(C2,X1)
	t2 := perpendicular(r2,X1)
	l2 := perpendicular(t2,A2)
	x2 := intersect(t2,l2)
	X2 := x2.1                          # second locus
	plot({P,r1,t1,l1,x1,r2,t2,l2,x2})
-->


<construction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xml/intergeo.xsd">
	<elements>
		<point id="C1">
			<homogeneous_coordinates>
				<double>0</double>
				<double>0</double>
				<double>1</double>
			</homogeneous_coordinates>
		</point>
		<point id="R">
			<homogeneous_coordinates>
				<double>1</double>
				<double>0</double>
				<double>1</double>
			</homogeneous_coordinates>
		</point>
		<point id="A1">
			<homogeneous_coordinates>
				<double>-3</double>
				<double>0</double>
				<double>1</double>
			</homogeneous_coordinates>
		</point>
		<point id="P">
			<homogeneous_coordinates>
				<double>0</double>
				<double>1</double>
				<double>1</double>
			</homogeneous_coordinates>
		</point>
		<point id="X1">
			<homogeneous_coordinates>
				<double>-3</double>
				<double>1</double>
				<double>1</double>
			</homogeneous_coordinates>
		</point>
		<line id="r1">
			<homogeneous_coordinates>
				<double>1</double>
				<double>0</double>
				<double>0</double>
			</homogeneous_coordinates>
		</line>
		<line id="t1">
			<homogeneous_coordinates>
				<double>0</double>
				<double>1</double>
				<double>1</double>
			</homogeneous_coordinates>
		</line>
		<line id="l1">
			<homogeneous_coordinates>
				<double>1</double>
				<double>0</double>
				<double>3</double>
			</homogeneous_coordinates>
		</line>
		<circle id="c">
			<matrix>
				<double>1</double>
				<double>0</double>
				<double>0</double>
				<double>0</double>
				<double>1</double>
				<double>0</double>
				<double>0</double>
				<double>0</double>
				<double>-1</double>
			</matrix>
		</circle>

		<locus id="L1"/>

		<point id="C2">
			<homogeneous_coordinates>
				<double>-2</double>
				<double>0</double>
				<double>1</double>
			</homogeneous_coordinates>
		</point>
		<point id="A2">
			<homogeneous_coordinates>
				<double>-5</double>
				<double>0</double>
				<double>1</double>
			</homogeneous_coordinates>
		</point>
		<line id="r2">
			<homogeneous_coordinates>
				<double>1</double>
				<double>1</double>
				<double>2</double>
			</homogeneous_coordinates>
		</line>
		<line id="t2">
			<homogeneous_coordinates>
				<double>1</double>
				<double>-1</double>
				<double>4</double>
			</homogeneous_coordinates>
		</line>
		<line id="l2">
			<homogeneous_coordinates>
				<double>1</double>
				<double>1</double>
				<double>5</double>
			</homogeneous_coordinates>
		</line>
		<point id="X2">
			<homogeneous_coordinates>
				<double>-4.5</double>
				<double>-0.5</double>
				<double>1</double>
			</homogeneous_coordinates>
		</point>

		<locus id="L2"/>
	</elements>
	<constraints>
		<circle_by_center_and_point>
			<circle out="true">c</circle>
			<point>C1</point>
			<point>R</point>
		</circle_by_center_and_point>
		<point_on_circle>
			<point out="true">P</point>
			<circle>c</circle>
		</point_on_circle>
		<line_through_two_points>
			<line out="true">r1</line>
			<point>C1</point>
			<point>P</point>
		</line_through_two_points>
		<line_perpendicular_to_line_through_point>
			<line out="true">t1</line>
			<point>P</point>
			<line>r1</line>
		</line_perpendicular_to_line_through_point>
		<line_perpendicular_to_line_through_point>
			<line out="true">l1</line>
			<point>A1</point>
			<line>t1</line>
		</line_perpendicular_to_line_through_point>
		<point_intersection_of_two_lines>
			<point out="true">X1</point>
			<line>t1</line>
			<line>l1</line>
		</point_intersection_of_two_lines>

		<locus_defined_by_point_on_circle>
			<locus out="true">L1</locus>
			<point>X1</point>
			<point>P</point>
			<circle>c</circle>
		</locus_defined_by_point_on_circle>

		<line_through_two_points>
			<line out="true">r2</line>
			<point>C2</point>
			<point>X1</point>
		</line_through_two_points>
		<line_perpendicular_to_line_through_point>
			<line out="true">t2</line>
			<point>X1</point>
			<line>r2</line>
		</line_perpendicular_to_line_through_point>
		<line_perpendicular_to_line_through_point>
			<line out="true">l2</line>
			<point>A2</point>
			<line>t2</line>
		</line_perpendicular_to_line_through_point>
		<point_intersection_of_two_lines>
			<point out="true">X2</point>
			<line>t2</line>
			<line>l2</line>
		</point_intersection_of_two_lines>

		<locus_defined_by_point_on_circle>
			<locus out="true">L2</locus>
			<point>X2</point>
			<point>X1</point>
			<circle>L1</circle>
		</locus_defined_by_point_on_circle>
	</constraints>
</construction>
