API / geotoolkit / util / LineSegment / LineSegment
util.LineSegment.LineSegment
This class is a 2D Line implementation. It holds two points define a line segment two dimensions.
It also provides some utility functions to manipulate Lines and do basic geometrical calculations
The line segment is defined by two points: start and end.
StartPoint----------------------------EndPoint
Constructors
| [new LineSegment()](/solutions/geotoolkit/apis/classes/geotoolkit.util.linesegment.linesegment.md#new linesegment()) | [new LineSegment(options)](/solutions/geotoolkit/apis/classes/geotoolkit.util.linesegment.linesegment.md#new linesegment(options)) | [new LineSegment(start, end)](/solutions/geotoolkit/apis/classes/geotoolkit.util.linesegment.linesegment.md#new linesegment(start, end)) |
|---|
Methods
Css Properties
Constructors
• new LineSegment()
• new LineSegment(options)
| Name | Type |
|---|---|
options | Options |
• new LineSegment(start, end)
Methods
▸ clone(): LineSegment
Clones this line segment and returns the newly created clone object
clone
▸ findIntersection(ls1, typeObject?, dst?): Point
Checks if two lines are intersecting. If they do, will return intersection point, if they don't, will return null. If second argument is passed, it will be assigned a property "intersectiontype", which will contain one of the IntersectionType types defining how the two line segments are correlated. If a destination point is provided, the point will be filled with intersection coordinates and returned. (optimization)
| Name | Type | Description |
|---|---|---|
ls1 | LineSegment | The line to check intersection with |
Optional typeObject | Object | An optional to which a property called "intersectiontype" will be added |
Optional typeObject.intersectiontype | IntersectionType | |
Optional dst | Point | Destination point to fill with intersection coordinates |
Point of intersection if intersecting. Null otherwise
▸ getClassName(): string
string
▸ getDistance(x, y): number
| Name | Type |
|---|---|
x | number |
y | number |
number
▸ getEnd(): Point
Return end point of the line segment
End point
▸ getLength(): number
Returns the length of the line segment
number
Length of the segment
▸ getProperties(): OptionsOut
Gets all the properties pertaining to this object
▸ getStart(): Point
Return start point of the line segment
Start point
▸ setEnd(end): LineSegment
| Name | Type |
|---|---|
end | Point |
▸ setEnd(x, y): LineSegment
| Name | Type |
|---|---|
x | number |
y | number |
▸ setLineSegment(start, end): LineSegment
Sets the two points which define a line segment.
| Name | Type | Description |
|---|---|---|
start | Point | Point representing the "start" position |
end | Point | Point representing the "end" position |
this
▸ setProperties(properties?): LineSegment
Sets all the properties pertaining to this object
| Name | Type | Description |
|---|---|---|
Optional properties | Options | object containing the properties to set |
this
▸ setStart(start): LineSegment
| Name | Type |
|---|---|
start | Point |
▸ setStart(x, y): LineSegment
| Name | Type |
|---|---|
x | number |
y | number |
▸ translate(dx, dy): LineSegment
Translates the line segment by the deltas passed as arguments
| Name | Type | Description |
|---|---|---|
dx | number | Change in x coordinates |
dy | number | Change in y coordinates |
this
▸ Static fromObject(object?): LineSegment
Create or get LineSegment from object
| Name | Type | Description |
|---|---|---|
Optional object | LineSegment | Options | object can be in format of constructor of LineSegment |
line segment
▸ Static getClassName(): string
string