Class TSubPolygon

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TSubPolygon = class(TObject)

Description

TSubPolygon is used to make determining whether a point is inside a TScreenObject faster and to make finding the nearest point on a line faster.

See also
EvaluateSubPolygon
EvaluateSubPolygon is used to help determine whether the point at X, Y is inside the TScreenObject.
IsAnyPointCloser
IsAnyPointCloser tests whether any point in the TScreenObject is closer to Location than Distance.

Hierarchy

Overview

Fields

Private FOriginalCount: integer;
Private FCount: integer;
Private FMaxX: real;
Private FMaxY: real;
Private FMinX: real;
Private FMinY: real;
Private FStart: integer;
Private FSubPolygon1: TSubPolygon;
Private FSubPolygon2: TSubPolygon;
Private FPoints: TRealPointArray;
Private FSectionIndex: integer;

Methods

Private procedure CreateSubPolygons(const Points: TRealPointArray; const Count, Start, Section: Integer);
Private procedure SetMaxAndMinWhenNoSubPolygons(const Count, Start: Integer; const Points: TRealPointArray);
Private procedure SetMaxAndMinFromSubPolygons;
Private procedure InternalBoxIntersect(SubPolygons: TList; const BoxMinX, BoxMaxX, BoxMinY, BoxMaxY: Double);
Private procedure EvaluateSubPolygon( const X, Y: real; var IsInside: boolean);
Public constructor Create(const Points: TRealPointArray; const Count, Start, Section: integer);
Public destructor Destroy; override;
Public procedure GrowByOne;
Public Procedure BoxIntersect(const Point1, Point2: TPoint2D; SubPolygons: TList);
Public function IsPointInside(const X, Y: real): boolean;

Properties

Public property SectionIndex: integer read FSectionIndex;

Description

Fields

Private FOriginalCount: integer;
 
Private FCount: integer;

FCount is the number of points used by the TSubPolygon.

Private FMaxX: real;

FMaxX is the maximum X value of any of the points used by the TSubPolygon.

Private FMaxY: real;

FMaxY is the maximum Y value of any of the points used by the TSubPolygon.

Private FMinX: real;

FMinX is the minimum X value of any of the points used by the TSubPolygon.

Private FMinY: real;

FMinY is the minimum Y value of any of the points used by the TSubPolygon.

Private FStart: integer;

FStart is the index of the first point used by the TSubPolygon.

Private FSubPolygon1: TSubPolygon;

FSubPolygon1 represents the TSubPolygon used to process the first half of the points if the number of points exceeds a threshold.

Private FSubPolygon2: TSubPolygon;

FSubPolygon2 represents the TSubPolygon used to process the second half of the points if the number of points exceeds a threshold.

Private FPoints: TRealPointArray;
 
Private FSectionIndex: integer;
 

Methods

Private procedure CreateSubPolygons(const Points: TRealPointArray; const Count, Start, Section: Integer);
 
Private procedure SetMaxAndMinWhenNoSubPolygons(const Count, Start: Integer; const Points: TRealPointArray);
 
Private procedure SetMaxAndMinFromSubPolygons;
 
Private procedure InternalBoxIntersect(SubPolygons: TList; const BoxMinX, BoxMaxX, BoxMinY, BoxMaxY: Double);
 
Private procedure EvaluateSubPolygon( const X, Y: real; var IsInside: boolean);
 
Public constructor Create(const Points: TRealPointArray; const Count, Start, Section: integer);

Create creates an instance of TSubPolygon. If Count is large enough, it will create FSubPolygon1 and FSubPolygon2 to handle what it needs to do.

Parameters
Points
is the array of TPoint2Ds to be used by TSubPolygon.
Count
is the number of TPoint2Ds in Points to be used by TSubPolygon.
Start
is the index of the first TPoint2Ds in Points to be used by TSubPolygon.
Section
indicates the part of the TScreenObject that this Create represents.
Public destructor Destroy; override;

Destroy destroys the current instance of TSubPolygon. Do not call Destroy directly. Call Free instead.

Public procedure GrowByOne;
 
Public Procedure BoxIntersect(const Point1, Point2: TPoint2D; SubPolygons: TList);
 
Public function IsPointInside(const X, Y: real): boolean;
 

Properties

Public property SectionIndex: integer read FSectionIndex;

If SectionIndex is created for a part of a TScreenObject, SectionIndex indicates which part of the TScreenObject it represents.


Generated by PasDoc 0.12.1 on 2013-05-13 15:42:00