<?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 antialiased"/>
			<pair key="description" value="This object represents a filled circle with the middle point (x, y), radius r and antialising. The points of the line 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="subObj1::outVar3::description" value="the antialising factor (1 is full transparent and 0 full opaque)"/>
			
			<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="isAntialiased" value=""/>
			<pair key="DbObject::isNotAntialiased" value="-55"/>
		</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 lines are just a space holder-->
					<naturalNumberB bit="0" />
					<naturalNumberB bit="0" />
					<naturalNumberB bit="0" />
				</vector>
			</externSubobject>
			<externObject>
				<vector elements="4">
					<integer min="-469" max="-469" /><!--Identifier-->
					<integer min="6" max="6" /><!--number input values-->
					<naturalNumber max="1" /><!--number subobjects-->
					<naturalNumber max="3" /><!--number output values-->
				</vector>
			</externObject>
			<externObjectInput identifier="-469">
				<vector elements="6">
					<naturalNumber max="0" />
					<naturalNumber max="0" />
					<naturalNumber max="0" />
					<naturalNumber max="0" />
					<naturalNumber max="0" />
					<naturalNumber max="0" />
				</vector>
			</externObjectInput>
			<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="2"/>
			</subfunction>
		</domains>
		<database_identifiers>
			<identifier>-469</identifier>
		</database_identifiers>
		<main_fib_object>
			<!-- for the next part:
				- b = ( r^2 - a^2 )^(1/2)
				- y_1 = y + a
				- y_2 = y - a
				- x_max = x + b
				- x_min = x - b
			For the border lines for antialising:
				- y_s = y
				- y_e = y + 1
				- call two times for y = y_1 and y = y_2:
					- line 1:
						- slope a_1 = a / b
						- a_0 = x_min - y * a_1
					- line 2:
						- slope b_1 = -a_1
						- b_0 = x_max - y * b_1
			-->
			<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>0</value>
						<variable>3</variable>
					</vector>
					<function define_variable="5">
						<!-- b^2 = r^2 - a^2 -->
						<subfunction>
							<sub>
								<exp>
									<variable>3</variable>
									<value>2</value>
								</exp>
								<exp>
									<variable>4</variable>
									<value>2</value>
								</exp>
							</sub>
						</subfunction>
						<function define_variable="6">
							<!-- b = ( r^2 - a^2 )^(1/2) -->
							<subfunction>
								<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>
							
							<function define_variable="7">
								<!-- x_min = x - b -->
								<subfunction>
									<sub>
										<variable>1</variable>
										<variable>6</variable>
									</sub>
								</subfunction>
								<function define_variable="8">
									<!-- x_max = x + b -->
									<subfunction>
										<add>
											<variable>1</variable>
											<variable>6</variable>
										</add>
									</subfunction>
									<function define_variable="9">
										<!-- a_1 = a / b -->
										<subfunction>
											<div>
												<variable>4</variable>
												<variable>6</variable>
											</div>
										</subfunction>
										<function define_variable="10">
											<!-- b_1 = -a_1 -->
											<subfunction>
												<sub>
													<value>0</value>
													<variable>9</variable>
												</sub>
											</subfunction>
											
											<list>
												<!-- upper half of circle -->
												<function define_variable="11">
													<!-- y_1 = y + a -->
													<subfunction>
														<add>
															<variable>2</variable>
															<variable>4</variable>
														</add>
													</subfunction>
													<function define_variable="12">
														<!-- y_e = y_1 + 1 -->
														<subfunction>
															<add>
																<variable>11</variable>
																<value>1</value>
															</add>
														</subfunction>
														<function define_variable="13">
															<!-- a_0 = x_min - y_1 * a_1 -->
															<subfunction>
																<sub>
																	<variable>7</variable>
																	<mult>
																		<variable>11</variable>
																		<variable>9</variable>
																	</mult>
																</sub>
															</subfunction>
															<function define_variable="14">
																<!-- b_0 = x_max - y_1 * b_1 -->
																<subfunction>
																	<sub>
																		<variable>8</variable>
																		<mult>
																			<variable>11</variable>
																			<variable>10</variable>
																		</mult>
																	</sub>
																</subfunction>
																
																<obj identifier="-469">
																	<vector type="externObjectInput">
																		<variable>11</variable>
																		<variable>12</variable>
																		<variable>13</variable>
																		<variable>9</variable>
																		<variable>14</variable>
																		<variable>10</variable>
																	</vector>
																	<subobject>
																		<output_variables>
																			<variable>15</variable>
																			<variable>16</variable>
																			<variable>17</variable>
																		</output_variables>
																		<subobject number="1">
																			<vector type="externSubobject">
																				<variable>16</variable>
																				<variable>15</variable>
																				<variable>17</variable>
																			</vector>
																		</subobject>
																	</subobject>
																</obj>
															</function>
														</function>
													</function>
												</function>
												<!-- lower half of circle -->
												<function define_variable="11">
													<!-- y_2 = y - a -->
													<subfunction>
														<sub>
															<variable>2</variable>
															<variable>4</variable>
														</sub>
													</subfunction>
													<function define_variable="12">
														<!-- y_e = y_2 + 1 -->
														<subfunction>
															<add>
																<variable>11</variable>
																<value>1</value>
															</add>
														</subfunction>
														<function define_variable="13">
															<!-- a_0 = x_min - y_2 / a_1 -->
															<subfunction>
																<sub>
																	<variable>7</variable>
																	<mult>
																		<variable>11</variable>
																		<variable>9</variable>
																	</mult>
																</sub>
															</subfunction>
															<function define_variable="14">
																<!-- b_0 = x_max - y_2 / b_1 -->
																<subfunction>
																	<sub>
																		<variable>8</variable>
																		<mult>
																			<variable>11</variable>
																			<variable>10</variable>
																		</mult>
																	</sub>
																</subfunction>
																
																<obj identifier="-469">
																	<vector type="externObjectInput">
																		<variable>11</variable>
																		<variable>12</variable>
																		<variable>13</variable>
																		<variable>9</variable>
																		<variable>14</variable>
																		<variable>10</variable>
																	</vector>
																	<subobject>
																		<output_variables>
																			<variable>15</variable>
																			<variable>16</variable>
																			<variable>17</variable>
																		</output_variables>
																		<subobject number="1">
																			<vector type="externSubobject">
																				<variable>16</variable>
																				<variable>15</variable>
																				<variable>17</variable>
																			</vector>
																		</subobject>
																	</subobject>
																</obj>
															</function>
														</function>
													</function>
												</function>
											
											</list>
										</function>
									</function>
								</function>
							</function>
						</function>
					</function>
				</area>
			</if>
		</main_fib_object>
	</root>
</fib_object>