<?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="evalue intersection of lines trougth points"/>
			<pair key="description" value="This object evalues the intersection of two lines betwean two points each. The line f_1 goes from the point p_1=(x_1, y_1) to p_2=(x_2, y_2). The line f_2 goes from the point p_3=(x_3, y_3) to p_4=(x_4, y_4). The intersection has to be between the points."/>
			<pair key="inVar1::description" value="position of the first point p_1 in dimension 1 (x_1) for line f_1"/>
			<pair key="inVar2::description" value="position of the first point p_1 in dimension 2 (y_1) for line f_1"/>
			<pair key="inVar3::description" value="position of the second point p_2 in dimension 1 (x_2) for line f_1"/>
			<pair key="inVar4::description" value="position of the second point p_2 in dimension 2 (y_2) for line f_1"/>
			<pair key="inVar5::description" value="position of the 3. point p_3 in dimension 1 (x_3) for line f_2"/>
			<pair key="inVar6::description" value="position of the 3. point p_3 in dimension 2 (y_3) for line f_2"/>
			<pair key="inVar7::description" value="position of the 4. point p_4 in dimension 1 (x_4) for line f_2"/>
			<pair key="inVar8::description" value="position of the 4. point p_4 in dimension 2 (y_4) for line f_2"/>
			
			<pair key="subObj1::description" value="if and wher the lines intersect"/>
			<pair key="subObj1::outVar1::description" value="the position of the intersection point in dimension 1 (x) if existing or 0"/>
			<pair key="subObj1::outVar2::description" value="the position of the intersection point in dimension 2 (y) if existing or 0"/>
			<pair key="subObj1::outVar3::description" value="0 if no intersection point exists, else 1"/>
			
			<pair key="author" value="Betti Oesterholz"/>
			<pair key="author::email" value="Oesterholz@Fib-Development.org"/>
			<pair key="copyright" value="LGPL3"/>
		</optionalpart>
		<input_variables>
			<variable number="1" default="0"/>
			<variable number="2" default="0"/>
			<variable number="3" default="0"/>
			<variable number="4" default="0"/>
			<variable number="5" default="0"/>
			<variable number="6" default="0"/>
			<variable number="7" default="0"/>
			<variable number="8" default="0"/>
		</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>
			<inVar number="3">
				<domainReference subdomain="1">
					<dim count="2">
						<dimension number="1" direction="anywhere"/>
						<dimension number="2" direction="anywhere"/>
					</dim>
				</domainReference>
			</inVar>
			<inVar number="4">
				<domainReference subdomain="2">
					<dim count="2">
						<dimension number="1" direction="anywhere"/>
						<dimension number="2" direction="anywhere"/>
					</dim>
				</domainReference>
			</inVar>
			<inVar number="5">
				<domainReference subdomain="1">
					<dim count="2">
						<dimension number="1" direction="anywhere"/>
						<dimension number="2" direction="anywhere"/>
					</dim>
				</domainReference>
			</inVar>
			<inVar number="6">
				<domainReference subdomain="2">
					<dim count="2">
						<dimension number="1" direction="anywhere"/>
						<dimension number="2" direction="anywhere"/>
					</dim>
				</domainReference>
			</inVar>
			<inVar number="7">
				<domainReference subdomain="1">
					<dim count="2">
						<dimension number="1" direction="anywhere"/>
						<dimension number="2" direction="anywhere"/>
					</dim>
				</domainReference>
			</inVar>
			<inVar number="8">
				<domainReference subdomain="2">
					<dim count="2">
						<dimension number="1" direction="anywhere"/>
						<dimension number="2" direction="anywhere"/>
					</dim>
				</domainReference>
			</inVar>
			<externSubobject number="1">
				<vector elements="3">
					<!--actually any number is possible;
						the next line is just a space holder-->
					<naturalNumberB bit="0" />
					<naturalNumberB bit="0" />
					<naturalNumberB bit="1" />
				</vector>
			</externSubobject>
			<externObject>
				<vector elements="4">
					<integer min="-95" max="-95" /><!--Identifier-->
					<integer min="4" max="4" /><!--number input values-->
					<naturalNumber max="1" /><!--number subobjects-->
					<naturalNumber max="3" /><!--number output values-->
				</vector>
			</externObject>
			<externObjectInput identifier="-95">
				<vector elements="4">
					<naturalNumber max="0" />
					<naturalNumber max="0" />
					<naturalNumber max="0" />
					<naturalNumber max="0" />
				</vector>
			</externObjectInput>
			<subfunction>
				<naturalNumberB bit="12" />
			</subfunction>
		</domains>
		<database_identifiers>
			<identifier>-95</identifier>
		</database_identifiers>
		<main_fib_object>
			<!-- check if ther is an intersection betwean the points -->
			<if><!-- intersection point not betwean the line points is not possible -->
				<condition>
					<or>
						<or>
							<lo><!-- max( x_1, x_2 ) < min( x_3, x_4 ) -->
								<max><!-- max( x_1, x_2 ) -->
									<variable>1</variable>
									<variable>3</variable>
								</max>
								<min><!-- min( x_3, x_4 ) -->
									<variable>5</variable>
									<variable>7</variable>
								</min>
							</lo>
							<lo><!-- max( x_3, x_4 ) < min( x_1, x_2 ) -->
								<max><!-- max( x_3, x_4 ) -->
									<variable>5</variable>
									<variable>7</variable>
								</max>
								<min><!-- min( x_1, x_2 ) -->
									<variable>1</variable>
									<variable>3</variable>
								</min>
							</lo>
						</or>
						<or>
							<lo><!-- max( y_1, y_2 ) < min( y_3, y_4 ) -->
								<max><!-- max( y_1, y_2 ) -->
									<variable>2</variable>
									<variable>4</variable>
								</max>
								<min><!-- min( y_3, y_4 ) -->
									<variable>6</variable>
									<variable>8</variable>
								</min>
							</lo>
							<lo><!-- max( y_3, y_4 ) < min( y_1, y_2 ) -->
								<max><!-- max( y_3, y_4 ) -->
									<variable>6</variable>
									<variable>8</variable>
								</max>
								<min><!-- min( y_1, y_2 ) -->
									<variable>2</variable>
									<variable>4</variable>
								</min>
							</lo>
						</or>
					</or>
				</condition>
				<!-- no intersection possible -->
				<subobject number="1">
					<vector type="externSubobject">
						<value>0</value>
						<value>0</value>
						<value>0</value>
					</vector>
				</subobject>
				<!-- else evalue intersection (if possible) -->
				<if><!-- if x_1 == x_2 then evalue f_2( x_1 ) for intersection -->
					<condition>
						<eqInt>
							<mult>
								<variable>1</variable>
								<value>2048</value>
							</mult>
							<mult>
								<variable>3</variable>
								<value>2048</value>
							</mult>
						</eqInt>
					</condition>
					<if><!-- if x_3 == x_4 ( and x_1 == x_2 ) then x_1 == x_2 == x_3 == x_4 -->
						<condition>
							<eqInt>
								<mult>
									<variable>5</variable>
									<value>2048</value>
								</mult>
								<mult>
									<variable>7</variable>
									<value>2048</value>
								</mult>
							</eqInt>
						</condition>
						<!-- check if the lines parts have just one point in commen,
						if yes return point as intersection point else no intersection-->
						<if><!-- if ( y_1 == y_3 ) || ( y_1 == y_4 ) then y_1 could be common point -->
							<condition>
								<or>
									<eqInt>
										<mult>
											<variable>2</variable>
											<value>2048</value>
										</mult>
										<mult>
											<variable>6</variable>
											<value>2048</value>
										</mult>
									</eqInt>
									<eqInt>
										<mult>
											<variable>2</variable>
											<value>2048</value>
										</mult>
										<mult>
											<variable>8</variable>
											<value>2048</value>
										</mult>
									</eqInt>
								</or>
							</condition>
							<if><!-- if ( y_1 == y_3 ) && ( ( ( y_1 < y_2 ) && ( y_4 < y_1 ) ) || ( ( y_2 < y_1 ) && ( y_1 < y_4 ) ) ) || ( y_1 == y_4 ) && ( ( ( y_1 < y_2 ) && ( y_3 < y_1 ) ) || ( ( y_2 < y_1 ) && ( y_1 < y_3 ) ) ) then y_1 is intersection point -->
								<condition>
									<or>
										<and>
											<eqInt>
												<mult>
													<variable>2</variable>
													<value>2048</value>
												</mult>
												<mult>
													<variable>6</variable>
													<value>2048</value>
												</mult>
											</eqInt>
											<not>
												<or>
													<and>
														<lo>
															<variable>2</variable>
															<variable>4</variable>
														</lo>
														<lo>
															<variable>2</variable>
															<variable>8</variable>
														</lo>
													</and>
													<and>
														<gr>
															<variable>2</variable>
															<variable>4</variable>
														</gr>
														<gr>
															<variable>2</variable>
															<variable>8</variable>
														</gr>
													</and>
												</or>
											</not>
										</and>
										
										<and>
											<eqInt>
												<mult>
													<variable>2</variable>
													<value>2048</value>
												</mult>
												<mult>
													<variable>8</variable>
													<value>2048</value>
												</mult>
											</eqInt>
											<not>
												<or>
													<and>
														<lo>
															<variable>2</variable>
															<variable>4</variable>
														</lo>
														<lo>
															<variable>2</variable>
															<variable>6</variable>
														</lo>
													</and>
													<and>
														<gr>
															<variable>2</variable>
															<variable>4</variable>
														</gr>
														<gr>
															<variable>2</variable>
															<variable>6</variable>
														</gr>
													</and>
												</or>
											</not>
										</and>
									</or>
								</condition>
								<subobject number="1"><!-- intersection point = (x_1, y_1) -->
									<vector type="externSubobject">
										<variable>1</variable>
										<variable>2</variable>
										<value>1</value>
									</vector>
								</subobject>
								<!-- else no intersection point -->
								<subobject number="1">
									<vector type="externSubobject">
										<value>0</value>
										<value>0</value>
										<value>0</value>
									</vector>
								</subobject>
							</if>
							<!-- else check if y_2 could be intersection point -->
							<if><!-- if ( y_2 == y_3 ) && ( ( ( y_2 < y_1 ) && ( y_4 < y_2 ) ) || ( ( y_1 < y_2 ) && ( y_2 < y_4 ) ) ) || ( y_2 == y_4 ) && ( ( ( y_2 < y_1 ) && ( y_3 < y_2 ) ) || ( ( y_1 < y_2 ) && ( y_2 < y_3 ) ) ) then y_2 is intersection point -->
								<condition>
									<or>
										<and>
											<eqInt>
												<mult>
													<variable>4</variable>
													<value>2048</value>
												</mult>
												<mult>
													<variable>6</variable>
													<value>2048</value>
												</mult>
											</eqInt>
											<or>
												<and>
													<lo>
														<variable>4</variable>
														<variable>2</variable>
													</lo>
													<gr>
														<variable>4</variable>
														<variable>8</variable>
													</gr>
												</and>
												<and>
													<gr>
														<variable>4</variable>
														<variable>2</variable>
													</gr>
													<lo>
														<variable>4</variable>
														<variable>8</variable>
													</lo>
												</and>
											</or>
										</and>
										
										<and>
											<eqInt>
												<mult>
													<variable>4</variable>
													<value>2048</value>
												</mult>
												<mult>
													<variable>8</variable>
													<value>2048</value>
												</mult>
											</eqInt>
											<or>
												<and>
													<lo>
														<variable>4</variable>
														<variable>2</variable>
													</lo>
													<gr>
														<variable>4</variable>
														<variable>6</variable>
													</gr>
												</and>
												<and>
													<gr>
														<variable>4</variable>
														<variable>2</variable>
													</gr>
													<lo>
														<variable>4</variable>
														<variable>6</variable>
													</lo>
												</and>
											</or>
										</and>
									</or>
								</condition>
								<subobject number="1"><!-- intersection point = (x_1, y_2) -->
									<vector type="externSubobject">
										<variable>1</variable>
										<variable>4</variable>
										<value>1</value>
									</vector>
								</subobject>
								<!-- else no intersection point -->
								<subobject number="1">
									<vector type="externSubobject">
										<value>0</value>
										<value>0</value>
										<value>0</value>
									</vector>
								</subobject>
							</if>
						</if>
						<!-- end case x_1 == x_2 == x_3 == x_4 -->
						<!-- else evalue f_2( x_1 ) for intersection-->
						<function define_variable="9">
							<!-- b_1 slope of the line f_2 -->
							<subfunction>
								<!-- b_1 = (y_4 - y_3) / (x_4 - x_3) -->
								<div>
									<sub>
										<variable>8</variable>
										<variable>6</variable>
									</sub>
									<sub>
										<variable>7</variable>
										<variable>5</variable>
									</sub>
								</div>
							</subfunction>
							<function define_variable="10">
								<!-- f_2( x_1 ) = ( y_3 - b_1 * x_3 ) + b_1 * x_1 = y_3 + b_1 * ( x_1 - x_3 ) -->
								<subfunction>
									<add>
										<variable>6</variable>
										<mult>
											<variable>9</variable>
											<sub>
												<variable>1</variable>
												<variable>5</variable>
											</sub>
										</mult>
									</add>
								</subfunction>
								<!-- check if point is on betwean points -->
								<if><!-- if intersection point not betwean the line points is not possible -->
									<condition>
										<or>
											<or>
												<lo><!-- max( y_1, y_2 ) < y -->
													<max><!-- max( y_1, y_2 ) -->
														<variable>2</variable>
														<variable>4</variable>
													</max>
													<variable>10</variable>
												</lo>
												<lo><!-- y < min( y_1, y_2 ) -->
													<variable>10</variable>
													<min><!-- min( y_1, y_2 ) -->
														<variable>2</variable>
														<variable>4</variable>
													</min>
												</lo>
											</or>
											<or>
												<or>
													<lo><!-- max( x_3, x_4 ) < x -->
														<max><!-- max( x_3, x_4 ) -->
															<variable>5</variable>
															<variable>7</variable>
														</max>
														<variable>1</variable>
													</lo>
													<lo><!-- x < min( x_3, x_4 ) -->
														<variable>1</variable>
														<min><!-- min( x_3, x_4 ) -->
															<variable>5</variable>
															<variable>7</variable>
														</min>
													</lo>
												</or>
												<or>
													<lo><!-- max( y_3, y_4 ) < y -->
														<max><!-- max( y_3, y_4 ) -->
															<variable>6</variable>
															<variable>8</variable>
														</max>
														<variable>10</variable>
													</lo>
													<lo><!-- y < min( y_3, y_4 ) -->
														<variable>10</variable>
														<min><!-- min( y_3, y_4 ) -->
															<variable>6</variable>
															<variable>8</variable>
														</min>
													</lo>
												</or>
											</or>
										</or>
									</condition>
									<!-- intersection not betwean points -->
									<subobject number="1">
										<vector type="externSubobject">
											<value>0</value>
											<value>0</value>
											<value>0</value>
										</vector>
									</subobject>
									<!-- else intersection betwean points -->
									<subobject number="1"><!-- intersection point = (x_1, f_2( x_1 ) ) -->
										<vector type="externSubobject">
											<variable>1</variable>
											<variable>10</variable>
											<value>1</value>
										</vector>
									</subobject>
								</if>
							</function>
						</function>
					</if><!-- end if x_1 == x_2 == x_3 == x_4 -->
					<!-- else x_1 != x_2 -->
					<function define_variable="9">
						<!-- a_1 slope of the line f_1 -->
						<subfunction>
							<!-- a_1 = (y_2 - y_1) / (x_2 - x_1) -->
							<div>
								<sub>
									<variable>4</variable>
									<variable>2</variable>
								</sub>
								<sub>
									<variable>3</variable>
									<variable>1</variable>
								</sub>
							</div>
						</subfunction>
						<function define_variable="10">
							<!-- a_0 = y_1 - a_1 * x_1 -->
							<subfunction>
								<sub>
									<variable>2</variable>
									<mult>
										<variable>9</variable>
										<variable>1</variable>
									</mult>
								</sub>
							</subfunction>
							<if><!-- if x_3 == x_4 then evalue f_1( x_3 ) for intersection -->
								<condition>
									<eqInt>
										<mult>
											<variable>5</variable>
											<value>2048</value>
										</mult>
										<mult>
											<variable>7</variable>
											<value>2048</value>
										</mult>
									</eqInt>
								</condition>
								<function define_variable="11">
									<!-- f_1( x_3 ) = a_0 + a_1 * x_3 -->
									<subfunction>
										<add>
											<variable>10</variable>
											<mult>
												<variable>9</variable>
												<variable>5</variable>
											</mult>
										</add>
									</subfunction>
									<!-- check if point is on betwean points -->
									<if><!-- if intersection point not betwean the line points is not possible -->
										<condition>
											<or>
												<or>
													<or>
														<lo><!-- max( x_1, x_2 ) < x -->
															<max><!-- max( x_1, x_2 ) -->
																<variable>1</variable>
																<variable>3</variable>
															</max>
															<variable>5</variable>
														</lo>
														<lo><!-- x < min( x_1, x_2 ) -->
															<variable>5</variable>
															<min><!-- min( x_1, x_2 ) -->
																<variable>1</variable>
																<variable>3</variable>
															</min>
														</lo>
													</or>
													<or>
														<lo><!-- max( y_1, y_2 ) < y -->
															<max><!-- max( y_1, y_2 ) -->
																<variable>2</variable>
																<variable>4</variable>
															</max>
															<variable>11</variable>
														</lo>
														<lo><!-- y < min( y_1, y_2 ) -->
															<variable>11</variable>
															<min><!-- min( y_1, y_2 ) -->
																<variable>2</variable>
																<variable>4</variable>
															</min>
														</lo>
													</or>
												</or>
												<or>
													<lo><!-- max( y_3, y_4 ) < y -->
														<max><!-- max( y_3, y_4 ) -->
															<variable>6</variable>
															<variable>8</variable>
														</max>
														<variable>11</variable>
													</lo>
													<lo><!-- y < min( y_3, y_4 ) -->
														<variable>11</variable>
														<min><!-- min( y_3, y_4 ) -->
															<variable>6</variable>
															<variable>8</variable>
														</min>
													</lo>
												</or>
											</or>
										</condition>
										<!-- intersection not betwean points -->
										<subobject number="1">
											<vector type="externSubobject">
												<value>0</value>
												<value>0</value>
												<value>0</value>
											</vector>
										</subobject>
										<!-- else intersection betwean points -->
										<subobject number="1"><!-- intersection point = ( x_3, f_1( x_3 ) ) -->
											<vector type="externSubobject">
												<variable>5</variable>
												<variable>11</variable>
												<value>1</value>
											</vector>
										</subobject>
									</if>
								</function>
								<!-- else evalue line parameters a_0, a_1, b_0 and b_1
									( f_1( x ) = a_0 + a_1 * x ; f_2( x ) = b_0 + b_1 * x )
									and evalue intersection of lines with database object id -95 -->
								<function define_variable="11">
									<!-- b_1 slope of the line f_1 -->
									<subfunction>
										<!-- b_1 = (y_4 - y_3) / (x_4 - x_3) -->
										<div>
											<sub>
												<variable>8</variable>
												<variable>6</variable>
											</sub>
											<sub>
												<variable>7</variable>
												<variable>5</variable>
											</sub>
										</div>
									</subfunction>
									<!-- if the slope is the same (a_1 == b_1) -> check if lines have one point in common, but do not overlap more -->
									<if><!-- if intersection point not betwean the line points is not possible -->
										<condition>
											<not>
												<or>
													<lo>
														<variable>9</variable>
														<variable>11</variable>
													</lo>
													<gr>
														<variable>9</variable>
														<variable>11</variable>
													</gr>
												</or>
											</not>
										</condition>
										<!-- the slope is the same (a_1 == b_1) -->
										<if><!-- if p_1 == p_3 check if p_2 is in p_4 direction then no intersection else p_1 is intersection -->
											<condition>
												<and><!-- p_1 == p_3 -->
													<not>
														<or>
															<lo>
																<variable>1</variable>
																<variable>5</variable>
															</lo>
															<gr>
																<variable>1</variable>
																<variable>5</variable>
															</gr>
														</or>
													</not>
													<not>
														<or>
															<lo>
																<variable>2</variable>
																<variable>6</variable>
															</lo>
															<gr>
																<variable>2</variable>
																<variable>6</variable>
															</gr>
														</or>
													</not>
												</and>
											</condition>
											<if><!-- p_2 is not in p_4 direction = ( ( x_2 < x_1 ) and ( x_1 < x_4) or ( x_4 < x_1 ) and ( x_1 < x_2 ) ) then p_1 is intersection else no intersection -->
												<condition>
													<or>
														<and>
															<lo>
																<variable>3</variable>
																<variable>1</variable>
															</lo>
															<lo>
																<variable>1</variable>
																<variable>7</variable>
															</lo>
														</and>
														<and>
															<lo>
																<variable>7</variable>
																<variable>1</variable>
															</lo>
															<lo>
																<variable>1</variable>
																<variable>3</variable>
															</lo>
														</and>
													</or>
												</condition>
												<!-- p_1 is intersection -->
												<subobject number="1">
													<vector type="externSubobject">
														<variable>1</variable>
														<variable>2</variable>
														<value>1</value>
													</vector>
												</subobject>
												<!-- else no intersection -->
												<subobject number="1">
													<vector type="externSubobject">
														<value>0</value>
														<value>0</value>
														<value>0</value>
													</vector>
												</subobject>
											</if>
											<if><!-- if p_1 == p_4 check if p_2 is in p_3 direction then no intersection else p_1 is intersection -->
												<condition>
													<and><!-- p_1 == p_3 -->
														<not>
															<or>
																<lo>
																	<variable>1</variable>
																	<variable>7</variable>
																</lo>
																<gr>
																	<variable>1</variable>
																	<variable>7</variable>
																</gr>
															</or>
														</not>
														<not>
															<or>
																<lo>
																	<variable>2</variable>
																	<variable>8</variable>
																</lo>
																<gr>
																	<variable>2</variable>
																	<variable>8</variable>
																</gr>
															</or>
														</not>
													</and>
												</condition>
												<if><!-- p_2 is not in p_3 direction = ( ( x_2 < x_1 ) and ( x_1 < x_3) or ( x_3 < x_1 ) and ( x_1 < x_2 ) ) then p_1 is intersection else no intersection -->
													<condition>
														<or>
															<and>
																<lo>
																	<variable>3</variable>
																	<variable>1</variable>
																</lo>
																<lo>
																	<variable>1</variable>
																	<variable>5</variable>
																</lo>
															</and>
															<and>
																<lo>
																	<variable>5</variable>
																	<variable>1</variable>
																</lo>
																<lo>
																	<variable>1</variable>
																	<variable>3</variable>
																</lo>
															</and>
														</or>
													</condition>
													<!-- p_1 is intersection -->
													<subobject number="1">
														<vector type="externSubobject">
															<variable>1</variable>
															<variable>2</variable>
															<value>1</value>
														</vector>
													</subobject>
													<!-- else no intersection -->
													<subobject number="1">
														<vector type="externSubobject">
															<value>0</value>
															<value>0</value>
															<value>0</value>
														</vector>
													</subobject>
												</if>
												<if><!-- if p_2 == p_3 check if p_1 is in p_4 direction then no intersection else p_2 is intersection -->
													<condition>
														<and><!-- p_2 == p_3 -->
															<not>
																<or>
																	<lo>
																		<variable>3</variable>
																		<variable>5</variable>
																	</lo>
																	<gr>
																		<variable>3</variable>
																		<variable>5</variable>
																	</gr>
																</or>
															</not>
															<not>
																<or>
																	<lo>
																		<variable>4</variable>
																		<variable>6</variable>
																	</lo>
																	<gr>
																		<variable>4</variable>
																		<variable>6</variable>
																	</gr>
																</or>
															</not>
														</and>
													</condition>
													<if><!-- p_1 is not in p_4 direction = ( ( x_1 < x_2 ) and ( x_2 < x_4) or ( x_4 < x_2 ) and ( x_2 < x_1 ) ) then p_2 is intersection else no intersection -->
														<condition>
															<or>
																<and>
																	<lo>
																		<variable>1</variable>
																		<variable>3</variable>
																	</lo>
																	<lo>
																		<variable>3</variable>
																		<variable>7</variable>
																	</lo>
																</and>
																<and>
																	<lo>
																		<variable>7</variable>
																		<variable>3</variable>
																	</lo>
																	<lo>
																		<variable>3</variable>
																		<variable>1</variable>
																	</lo>
																</and>
															</or>
														</condition>
														<!-- p_2 is intersection -->
														<subobject number="1">
															<vector type="externSubobject">
																<variable>3</variable>
																<variable>4</variable>
																<value>1</value>
															</vector>
														</subobject>
														<!-- else no intersection -->
														<subobject number="1">
															<vector type="externSubobject">
																<value>0</value>
																<value>0</value>
																<value>0</value>
															</vector>
														</subobject>
													</if>
													<if><!-- if p_2 == p_4 check if p_1 is in p_3 direction then no intersection else p_2 is intersection -->
														<condition>
															<and><!-- p_2 == p_4 -->
																<not>
																	<or>
																		<lo>
																			<variable>3</variable>
																			<variable>7</variable>
																		</lo>
																		<gr>
																			<variable>3</variable>
																			<variable>7</variable>
																		</gr>
																	</or>
																</not>
																<not>
																	<or>
																		<lo>
																			<variable>4</variable>
																			<variable>8</variable>
																		</lo>
																		<gr>
																			<variable>4</variable>
																			<variable>8</variable>
																		</gr>
																	</or>
																</not>
															</and>
														</condition>
														<if><!-- p_1 is not in p_3 direction = ( ( x_1 < x_2 ) and ( x_2 < x_3) or ( x_3 < x_2 ) and ( x_2 < x_1 ) ) then p_2 is intersection else no intersection -->
															<condition>
																<or>
																	<and>
																		<lo>
																			<variable>1</variable>
																			<variable>3</variable>
																		</lo>
																		<lo>
																			<variable>3</variable>
																			<variable>5</variable>
																		</lo>
																	</and>
																	<and>
																		<lo>
																			<variable>5</variable>
																			<variable>3</variable>
																		</lo>
																		<lo>
																			<variable>3</variable>
																			<variable>1</variable>
																		</lo>
																	</and>
																</or>
															</condition>
															<!-- p_2 is intersection -->
															<subobject number="1">
																<vector type="externSubobject">
																	<variable>3</variable>
																	<variable>4</variable>
																	<value>1</value>
																</vector>
															</subobject>
															<!-- else no intersection -->
															<subobject number="1">
																<vector type="externSubobject">
																	<value>0</value>
																	<value>0</value>
																	<value>0</value>
																</vector>
															</subobject>
														</if>
														<!-- else no intersection -->
														<subobject number="1">
															<vector type="externSubobject">
																<value>0</value>
																<value>0</value>
																<value>0</value>
															</vector>
														</subobject>
													</if>
												</if>
											</if>
										</if>
										<!-- else evalue intersection-->
										<function define_variable="12">
											<!-- b_0 = y_3 - b_1 * x_3 -->
											<subfunction>
												<sub>
													<variable>6</variable>
													<mult>
														<variable>11</variable>
														<variable>5</variable>
													</mult>
												</sub>
											</subfunction>
											<obj identifier="-95">
												<vector type="externObjectInput">
													<variable>10</variable>
													<variable>9</variable>
													<variable>12</variable>
													<variable>11</variable>
												</vector>
												<subobject>
													<output_variables>
														<variable>13</variable>
														<variable>14</variable>
														<variable>15</variable>
													</output_variables>
													
													<!-- check if point is on betwean points -->
													<if><!-- if intersection point not betwean the line points is not possible -->
														<condition>
															<or>
																<or>
																	<or>
																		<lo><!-- max( x_1, x_2 ) < x -->
																			<max><!-- max( x_1, x_2 ) -->
																				<variable>1</variable>
																				<variable>3</variable>
																			</max>
																			<variable>13</variable>
																		</lo>
																		<lo><!-- x < min( x_1, x_2 ) -->
																			<variable>13</variable>
																			<min><!-- min( x_1, x_2 ) -->
																				<variable>1</variable>
																				<variable>3</variable>
																			</min>
																		</lo>
																	</or>
																	<or>
																		<lo><!-- max( y_1, y_2 ) < y -->
																			<max><!-- max( y_1, y_2 ) -->
																				<variable>2</variable>
																				<variable>4</variable>
																			</max>
																			<variable>14</variable>
																		</lo>
																		<lo><!-- y < min( y_1, y_2 ) -->
																			<variable>14</variable>
																			<min><!-- min( y_1, y_2 ) -->
																				<variable>2</variable>
																				<variable>4</variable>
																			</min>
																		</lo>
																	</or>
																</or>
																<or>
																	<or>
																		<lo><!-- max( x_3, x_4 ) < x -->
																			<max><!-- max( x_3, x_4 ) -->
																				<variable>5</variable>
																				<variable>7</variable>
																			</max>
																			<variable>13</variable>
																		</lo>
																		<lo><!-- x < min( x_3, x_4 ) -->
																			<variable>13</variable>
																			<min><!-- min( x_3, x_4 ) -->
																				<variable>5</variable>
																				<variable>7</variable>
																			</min>
																		</lo>
																	</or>
																	<or>
																		<lo><!-- max( y_3, y_4 ) < y -->
																			<max><!-- max( y_3, y_4 ) -->
																				<variable>6</variable>
																				<variable>8</variable>
																			</max>
																			<variable>14</variable>
																		</lo>
																		<lo><!-- y < min( y_3, y_4 ) -->
																			<variable>14</variable>
																			<min><!-- min( y_3, y_4 ) -->
																				<variable>6</variable>
																				<variable>8</variable>
																			</min>
																		</lo>
																	</or>
																</or>
															</or>
														</condition>
														<!-- intersection not betwean points -->
														<subobject number="1">
															<vector type="externSubobject">
																<value>0</value>
																<value>0</value>
																<value>0</value>
															</vector>
														</subobject>
														<!-- else intersection betwean points -->
														<subobject number="1">
															<vector type="externSubobject">
																<variable>13</variable>
																<variable>14</variable>
																<variable>15</variable>
															</vector>
														</subobject>
													</if>
												</subobject>
											</obj>
										</function>
									</if>
								</function>
							</if>
						</function>
					</function>
				</if>
			</if>
		</main_fib_object>
	</root>
</fib_object>