# Unit CastleLine2DMath

Uses
Classes, Interfaces, Objects and Records
Types
Constants
Variables

## Description

The module contains some mathematical methods, as well as methods for constructing some primitives.

## Overview

### Functions and Procedures

 `function DoFloat(var StringValue:string;const Remain:string=''):single;` `function PSDistanceEx(const P,SP1,SP2:TVector2;var Distance:Single; var PP:TVector2):integer;` `function CrossingSegments(const a1,a2,b1,b2:TVector2; var CrossPoint:TVector2):shortint;` `function IsClockwiseTriangle(A,B,C:TVector2):boolean;` `function AddArcBetweenPoints(var Arc:TVector2List; const Center,O,A,B:TVector2; const EdgesCount:integer):single;` `procedure AddRoundBoxTop(var Arc:TVector2List; const A,B:TVector2; const Opposite:Tvector2; const EdgesCount:integer);` `procedure AddHalfCircle(var Arc:TVector2List; const A,B:TVector2; const EdgesCount:integer; const Opposite:Tvector2);` `procedure AddTriangle(var Arc:TVector2List; const A,B,C:TVector2);` `procedure AddTriangleOpposite(var Arc:TVector2List; const A,B:TVector2; const Opposite:Tvector2);` `procedure AddTriangleTop(var Arc:TVector2List; const A,B:TVector2; const Opposite:Tvector2);` `procedure AddHalfBox(var Arc:TVector2List; const A,B:TVector2; const Opposite:Tvector2);` `procedure AddBox(var Arc:TVector2List; const A,B:TVector2; const Opposite:Tvector2);` `procedure AddRect(var Arc:TVector2List; const A,B:TVector2; width:single);` `function AddCrossSegments(var Arc:TVector2List; const O,A1,A2,B1,B2:TVector2):single;` `function DoGoodTriangle(var Lt:TVector2List; A,B,C:integer; Scale:TVector2):boolean;`

## Description

### Functions and Procedures

 `function DoFloat(var StringValue:string;const Remain:string=''):single;` Converts StringValue to a number by removing the excess. Remain is a non-removable remainder in a string (can be used to ensure that the '-' at the beginning of the line is not deleted)
 `function PSDistanceEx(const P,SP1,SP2:TVector2;var Distance:Single; var PP:TVector2):integer;` The minimum distance from the point(P) to the segment(SP1:SP2) with the calculation of the projection point (PP) on the segment. 0 - the point is projected onto the segment: Distance = distance from P to the segment SP1,SP2. PP 1 - point P lies "to left" of SP1: Distance = distance from P to SP1. PP=SP1 2 - point P lies "to right" of SP2: Distance = distance from P to SP2. PP=SP2
 `function CrossingSegments(const a1,a2,b1,b2:TVector2; var CrossPoint:TVector2):shortint;` Intersection of segments A1:A2, B1:B2 1 if there is one intersection point "CrossPoint" 0 if chunks ar on parallel lines -1 if there are no intersection points
 `function IsClockwiseTriangle(A,B,C:TVector2):boolean;` If the order of traversal of triangle A,B,C is clockwise, then returns `True`
 `function AddArcBetweenPoints(var Arc:TVector2List; const Center,O,A,B:TVector2; const EdgesCount:integer):single;` Builds an arc between points A,B with the center at the point Center O - the point of connection of the segments (may coincide with the Center) EdgesCount - number of segments The resulting triangles are added to Arc Result = arc length
 `procedure AddRoundBoxTop(var Arc:TVector2List; const A,B:TVector2; const Opposite:Tvector2; const EdgesCount:integer);` Builds a square with one corner rounded on the segment A:B in the direction opposite to the Opposite. EdgesCount - the number of arc segments. Result = arc length.
 `procedure AddHalfCircle(var Arc:TVector2List; const A,B:TVector2; const EdgesCount:integer; const Opposite:Tvector2);` Builds a semicircle on the segment A:B in the opposite direction Opposite EdgesCount - number of segments The resulting triangles are added to Arc
 `procedure AddTriangle(var Arc:TVector2List; const A,B,C:TVector2);` Adds a triangle to the Arc
 `procedure AddTriangleOpposite(var Arc:TVector2List; const A,B:TVector2; const Opposite:Tvector2);` Builds a rectangular isosceles triangle on the segment A:B in the opposite direction Opposite. Hypotenuse - A:B
 `procedure AddTriangleTop(var Arc:TVector2List; const A,B:TVector2; const Opposite:Tvector2);` Builds a rectangular isosceles triangle on the segment A:B in the direction opposite to the Opposite. Hypotenuse - A:New Point
 `procedure AddHalfBox(var Arc:TVector2List; const A,B:TVector2; const Opposite:Tvector2);` Builds a half square on the segment A:B in the opposite direction Opposite
 `procedure AddBox(var Arc:TVector2List; const A,B:TVector2; const Opposite:Tvector2);` Builds a square on the segment A:B in the opposite direction of the Opposite.
 `procedure AddRect(var Arc:TVector2List; const A,B:TVector2; width:single);` Builds a rectangle whose axis of symmetry is the segment A:B. Creates 0..5 points 4 point equals 0 point. 5 point equals 2 point If A.XB.X, the zero point is the upper right If A.X=B.X and A.YB.Y, the zero point is the upper left Traversing the rectangle clockwise width - height of the rectangle
 `function AddCrossSegments(var Arc:TVector2List; const O,A1,A2,B1,B2:TVector2):single;` Adds triangles to connect two segments at the intersection point outside of these segments. A1:A2 the first segment. B1:B2 is the second segment. O is the junction point of the triangles. As a result, construct triangles (O,A2,cross) and (O,B2,cross). Result = length of the constructed segments
 `function DoGoodTriangle(var Lt:TVector2List; A,B,C:integer; Scale:TVector2):boolean;` Sorts the vertices of the triangle in clockwise traversal order depending on the "Scale" (in the 2nd and 4th quarters, the order of traversal changes). If changes have been made (B and C have been swapped), it will return true.

Generated by PasDoc 0.16.0.