VectSharp 2.5.0
A light library for C# vector graphics
Loading...
Searching...
No Matches
VectSharp.Segment Class Referenceabstract

Represents a segment as part of a GraphicsPath. More...

Public Member Functions

abstract Segment Clone ()
 Creates a copy of the Segment. More...
 
abstract double Measure (Point previousPoint)
 Computes the length of the Segment. More...
 
abstract Point GetPointAt (Point previousPoint, double position)
 Gets the point on the Segment at the specified (relative) position ). More...
 
abstract Point GetTangentAt (Point previousPoint, double position)
 Gets the tangent to the Segment at the specified (relative) position ). More...
 
abstract IEnumerable< SegmentLinearise (Point? previousPoint, double resolution)
 Transform the segment into a series of linear segments. Segments that are already linear are not changed. More...
 
abstract IEnumerable< PointGetLinearisationTangents (Point? previousPoint, double resolution)
 Gets the tanget at the points at which the segment would be linearised. More...
 
abstract IEnumerable< SegmentTransform (Func< Point, Point > transformationFunction)
 Applies an arbitrary transformation to all of the points of the Segment. More...
 
abstract IEnumerable< SegmentFlatten (Point? previousPoint, double flatness)
 Flattens the Segment, replacing curve segments with series of line segments that approximate them, ensuring the specified maximum deviation from the original path. More...
 
abstract IEnumerable<(Point point, Point tangent)> FlattenForOffsetAndGetTangents (Point? previousPoint, double offset, double flatness)
 Flattens the Segment, replacing curve segments with series of line segments that approximate them, ensuring the specified maximum deviation from the original path, assuming that the Segment will be drawn with the specified offset . More...
 

Properties

abstract SegmentType Type [get]
 The type of the Segment. More...
 
Point[] Points [get]
 The points used to define the Segment. More...
 
virtual Point Point [get]
 The end point of the Segment. More...
 

Detailed Description

Represents a segment as part of a GraphicsPath.

Definition at line 28 of file Segment.cs.

Member Function Documentation

◆ Clone()

abstract Segment VectSharp.Segment.Clone ( )
pure virtual

Creates a copy of the Segment.

Returns
A copy of the Segment.

◆ Flatten()

abstract IEnumerable< Segment > VectSharp.Segment.Flatten ( Point previousPoint,
double  flatness 
)
pure virtual

Flattens the Segment, replacing curve segments with series of line segments that approximate them, ensuring the specified maximum deviation from the original path.

Parameters
previousPointThe point from which the Segment starts (i.e. the endpoint of the previous Segment).
flatnessThe maximum deviation from the original path.
Returns
A collection of Segments composed only of linear segments that approximates the current Segment.

◆ FlattenForOffsetAndGetTangents()

abstract IEnumerable<(Point point, Point tangent)> VectSharp.Segment.FlattenForOffsetAndGetTangents ( Point previousPoint,
double  offset,
double  flatness 
)
pure virtual

Flattens the Segment, replacing curve segments with series of line segments that approximate them, ensuring the specified maximum deviation from the original path, assuming that the Segment will be drawn with the specified offset .

Parameters
previousPointThe point from which the Segment starts (i.e. the endpoint of the previous Segment).
offsetThe offset that will be used to draw the Segment (e.g., the line width of the stroke).
flatnessThe maximum deviation from the original path.
Returns
A collection of tuples where the first element is a Point representing the end-point of a linear segment, and the second element is a Point containing the value of the tangent to the original Segment at that point.

◆ GetLinearisationTangents()

abstract IEnumerable< Point > VectSharp.Segment.GetLinearisationTangents ( Point previousPoint,
double  resolution 
)
pure virtual

Gets the tanget at the points at which the segment would be linearised.

Parameters
previousPointThe point from which the Segment starts (i.e. the endpoint of the previous Segment).
resolutionThe absolute length between successive samples in curve segments.
Returns
A collection of tangents at the points in which the segment would be linearised.

◆ GetPointAt()

abstract Point VectSharp.Segment.GetPointAt ( Point  previousPoint,
double  position 
)
pure virtual

Gets the point on the Segment at the specified (relative) position ).

Parameters
previousPointThe point from which the Segment starts (i.e. the endpoint of the previous Segment).
positionThe relative position on the Segment (0 is the start of the Segment, 1 is the end of the Segment).
Returns
The point at the specified position.

◆ GetTangentAt()

abstract Point VectSharp.Segment.GetTangentAt ( Point  previousPoint,
double  position 
)
pure virtual

Gets the tangent to the Segment at the specified (relative) position ).

Parameters
previousPointThe point from which the Segment starts (i.e. the endpoint of the previous Segment).
positionThe relative position on the Segment (0 is the start of the Segment, 1 is the end of the Segment).
Returns
The tangent to the point at the specified position.

◆ Linearise()

abstract IEnumerable< Segment > VectSharp.Segment.Linearise ( Point previousPoint,
double  resolution 
)
pure virtual

Transform the segment into a series of linear segments. Segments that are already linear are not changed.

Parameters
previousPointThe point from which the Segment starts (i.e. the endpoint of the previous Segment).
resolutionThe absolute length between successive samples in curve segments.
Returns
A collection of linear segments that approximate the current segment.

◆ Measure()

abstract double VectSharp.Segment.Measure ( Point  previousPoint)
pure virtual

Computes the length of the Segment.

Parameters
previousPointThe point from which the Segment starts (i.e. the endpoint of the previous Segment).
Returns
The length of the segment.

◆ Transform()

abstract IEnumerable< Segment > VectSharp.Segment.Transform ( Func< Point, Point transformationFunction)
pure virtual

Applies an arbitrary transformation to all of the points of the Segment.

Parameters
transformationFunctionAn arbitrary transformation function.
Returns
A collection of Segments that have been transformed according to the transformationFunction .

Property Documentation

◆ Point

virtual Point VectSharp.Segment.Point
get

The end point of the Segment.

Definition at line 44 of file Segment.cs.

◆ Points

Point [] VectSharp.Segment.Points
get

The points used to define the Segment.

Definition at line 39 of file Segment.cs.

◆ Type

abstract SegmentType VectSharp.Segment.Type
get

The type of the Segment.

Definition at line 34 of file Segment.cs.


The documentation for this class was generated from the following file: