<?xml version="1.0" encoding="UTF-8"?>
<fib_object
			  xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
			  xmlns="http://www.fib-development.org/"
			  xsd:schemaLocation="http://www.fib-development.org/fib.xsd">
	<root>
		<multimedia_info fib_version="3" db_version="2"/>
		<optionalpart>
			<pair key="name" value="circle"/>
			<pair key="description" value="This object represents a filled circle with the middle point (x, y) and radius r. The points of the circle are given back as variables of the subobject."/>
			<pair key="inVar1::description" value="position of the middle point in dimension 1 (x)"/>
			<pair key="inVar2::description" value="position of the middle point in dimension 2 (y)"/>
			<pair key="inVar3::description" value="size of the radius r"/>
			
			<pair key="subObj1::description" value="The points of the circle. The subobject is called for every point on the circle."/>
			<pair key="subObj1::outVar1::description" value="the position of the circle point in dimension 1 (x)"/>
			<pair key="subObj1::outVar2::description" value="the position of the circle point in dimension 2 (y)"/>
			
			<pair key="author" value="Betti Oesterholz"/>
			<pair key="author::email" value="Oesterholz@Fib-Development.org"/>
			<pair key="copyright" value="LGPL3"/>
			
			<pair key="isPointSubObject" value=""/>
			<pair key="DbObject::isPointElement" value="-50"/>
			<pair key="isNotAntialiased" value=""/>
			<pair key="DbObject::isAntialiased" value="-56"/>
		</optionalpart>
		<input_variables>
			<variable number="1" default="0"/>
			<variable number="2" default="0"/>
			<variable number="3" default="1"/>
		</input_variables>
		<domains>
			<inVar number="1">
				<domainReference subdomain="1">
					<dim count="2">
						<dimension number="1" direction="anywhere"/>
						<dimension number="2" direction="anywhere"/>
					</dim>
				</domainReference>
			</inVar>
			<inVar number="2">
				<domainReference subdomain="2">
					<dim count="2">
						<dimension number="1" direction="anywhere"/>
						<dimension number="2" direction="anywhere"/>
					</dim>
				</domainReference>
			</inVar>
			<externSubobject number="1">
				<vector elements="2">
					<!--actually any numbers are possible;
						the next two lines are just a space holder-->
					<naturalNumberB bit="0" />
					<naturalNumberB bit="0" />
				</vector>
			</externSubobject>
			<area>
				<vector elements="2">
					<naturalNumber max="1" />
					<vector elements="2">
						<naturalNumber max="0" />
						<naturalNumber max="0" />
					</vector>
				</vector>
			</area>
			<subfunction>
				<naturalNumber scalingfactor="0.5" max="4"/>
			</subfunction>
		</domains>
		<main_fib_object>
			<if>
				<condition><!-- if radius is negativ -> do nothing -->
					<lo>
						<variable>3</variable>
						<value>0</value>
					</lo>
				</condition>
				<point/>
				<!-- else draw circle -->
				<area define_variable="4"><!-- for a -->
					<vector type="subarea">
						<value>1</value>
						<variable>3</variable>
					</vector>
					<function define_variable="5">
						<subfunction><!-- b^2 = r^2 - a^2 -->
							<sub>
								<exp>
									<variable>3</variable>
									<value>2</value>
								</exp>
								<exp>
									<variable>4</variable>
									<value>2</value>
								</exp>
							</sub>
						</subfunction>
						<function define_variable="6">
							<subfunction><!-- b = ( r^2 - a^2 )^(1/2) -->
								<if>
									<lo><!-- 0 < r^2 - a^2 -->
										<value>0</value>
										<variable>5</variable>
									</lo>
									<!-- b = ( r^2 - a^2 )^(1/2) -->
									<exp>
										<variable>5</variable>
										<value>0.5</value>
									</exp>
									<!-- else b = 0 -->
									<value>0</value>
								</if>
							</subfunction>
							<list>
								<!-- upper half of circle -->
								<function define_variable="7">
									<subfunction><!-- x_i = x + a - 2 -->
										<sub>
											<add>
												<variable>1</variable>
												<variable>4</variable>
											</add>
											<value>2</value>
										</sub>
									</subfunction>
									<function define_variable="8">
										<subfunction><!-- y_min = y - b -->
											<sub>
												<variable>2</variable>
												<variable>6</variable>
											</sub>
										</subfunction>
										<function define_variable="9">
											<subfunction><!-- y_max = y + b - 1 -->
												<sub>
													<add>
														<variable>2</variable>
														<variable>6</variable>
													</add>
													<value>1</value>
												</sub>
											</subfunction>
											<area define_variable="10">
												<vector type="subarea">
													<variable>8</variable>
													<variable>9</variable>
												</vector>
												<subobject number="1">
													<vector type="externSubobject">
														<variable>7</variable>
														<variable>10</variable>
													</vector>
												</subobject>
											</area>
										</function>
									</function>
								</function>
								<!-- lower half of circle -->
								<function define_variable="7">
									<subfunction><!-- x_i = x - a - 1 -->
										<sub>
											<sub>
												<variable>1</variable>
												<variable>4</variable>
											</sub>
											<value>1</value>
										</sub>
									</subfunction>
									<function define_variable="8">
										<subfunction><!-- y_min = y - b -->
											<sub>
												<variable>2</variable>
												<variable>6</variable>
											</sub>
										</subfunction>
										<function define_variable="9">
											<subfunction><!-- y_max = y + b - 1 -->
												<sub>
													<add>
														<variable>2</variable>
														<variable>6</variable>
													</add>
													<value>1</value>
												</sub>
											</subfunction>
											<area define_variable="10">
												<vector type="subarea">
													<variable>8</variable>
													<variable>9</variable>
												</vector>
												<subobject number="1">
													<vector type="externSubobject">
														<variable>7</variable>
														<variable>10</variable>
													</vector>
												</subobject>
											</area>
										</function>
									</function>
								</function>
							</list>
						</function>
					</function>
				</area>
			</if>
		</main_fib_object>
	</root>
</fib_object>