Hatch
OCCT package Hatch: Hatch_Hatcher, Hatch_Line, Hatch_LineForm, Hatch_Parameter.
Hatch_Hatcher
The Hatcher is an algorithm to compute cross hatchings in a 2d plane. It is mainly dedicated to display purpose.
Computing cross hatchings is a 3 steps process :
- The users stores in the Hatcher a set of 2d lines to be trimmed. Methods in the "Lines" category.
- The user trims the lines with a boundary. The inside of a boundary is on the left side. Methods in the "Trimming" category.
- The user reads back the trimmed lines. Methods in the "Results" category.
The result is a set of parameter intervals on the line. The first parameter of anIntervalmay beRealFirst()and the last may beRealLast().
A line can be a line parallel to the axis (X or Y line or a 2D line.
The Hatcher has two modes :
- The "Oriented" mode, where the orientation of the trimming curves is considered. The hatch are kept on the left of the trimming curve. In this mode infinite hatch can be computed.
- The "UnOriented" mode, where the hatch are always finite.
Constructors(1)
- constructor(Tol: number, Oriented?: boolean): Hatch_Hatcher
Returns an empty hatcher. <Tol> is the tolerance for intersections.
Parameters (2)TolOriented
Instance methods(21)
- Tolerance(Tol: number): voidParameters (1)
Tol
- Tolerance(): number
- AddLine(L: gp_Lin2d, T: Hatch_LineForm): void
Add a line <L> to be trimmed. <T> the type is only kept from information. It is not used in the computation.
Parameters (2)LT
Add an infinite line on direction <D> at distance <Dist> from the origin to be trimmed. <Dist> may be negative.
If O is the origin of the 2D plane, and V the vector perpendicular to D (in the direct direction).
A point P is on the line if : OP dot V = Dist The parameter of P on the line is OP dot DParameters (2)DDist
- AddXLine(X: number): void
Add an infinite line parallel to the Y-axis at abciss <X>.
Parameters (1)X
- AddYLine(Y: number): void
Add an infinite line parallel to the X-axis at ordinate <Y>.
Parameters (1)Y
Trims the lines at intersections with <L>.
Parameters (2)LIndex
Trims the lines at intersections with <L> in the parameter range <Start>, <End>.
Parameters (4)LStartEndIndex
Trims the line at intersection with the oriented segment P1,P2.
Parameters (3)P1P2Index
- NbIntervals(): number
Returns the total number of intervals on all the lines.
- NbIntervals(I: number): number
Returns the number of intervals on line of index .
Parameters (1)I
- NbLines(): number
Returns the number of lines.
Returns the line of index .
Parameters (1)I
- LineForm(I: number): Hatch_LineForm
Returns the type of the line of index .
Parameters (1)I
- IsXLine(I: number): boolean
Returns True if the line of index has a constant X value.
Parameters (1)I
- IsYLine(I: number): boolean
Returns True if the line of index has a constant Y value.
Parameters (1)I
- Coordinate(I: number): number
Returns the X or Y coordinate of the line of index if it is a X or a Y line.
Parameters (1)I
- Start(I: number, J: number): number
Returns the first parameter of interval <J> on line .
Parameters (2)IJ
- StartIndex(I: number, J: number, Index: number, Par2: number): { Index: number; Par2: number }
Returns the first Index and Par2 of interval <J> on line .
Parameters (4)IJIndexPar2
ReturnsA result object with fields:
Index: updated value from the call.Par2: updated value from the call.
- End(I: number, J: number): number
Returns the last parameter of interval <J> on line .
Parameters (2)IJ
- EndIndex(I: number, J: number, Index: number, Par2: number): { Index: number; Par2: number }
Returns the last Index and Par2 of interval <J> on line .
Parameters (4)IJIndexPar2
ReturnsA result object with fields:
Index: updated value from the call.Par2: updated value from the call.
Hatch_Line
Stores a Line in the Hatcher. Represented by:
- A Lin2d from gp, the geometry of the line.
- Bounding parameters for the line.
- A sorted List of Parameters, the intersections on the line.
Constructors(2)
- constructor(L: gp_Lin2d, T: Hatch_LineForm): Hatch_LineParameters (2)
LT
Instance methods(1)
- AddIntersection(Par1: number, Start: boolean, Index: number, Par2: number, theToler: number): void
Insert a new intersection in the sorted list.
Parameters (5)Par1StartIndexPar2theToler
Hatch_LineForm
Properties(3)
Hatch_Parameter
Stores an intersection on a line represented by :
- A Real parameter.
- A flag True when the parameter starts an interval.
Constructors(2)
- constructor(Par1: number, Start: boolean, Index?: number, Par2?: number): Hatch_ParameterParameters (4)
Par1StartIndexPar2