ArcSpan

From SDK
Jump to navigation Jump to search
Back.jpg

This object represents an arc span in a Contour. It is derived from the Span class and all methods and properties of the span class are valid on this object as well. As well as creating spans to append to a contour you can use the ArcTo methods to avoid span creation. Arcs are represented internally using the start and end points and a ‘bulge factor’ which controls the shape of the arc. The bulge represents a ratio between the chord length of an arc and its height (bulge = (2*arc_height) / chord_length).

Constructors

ArcSpan(Point2D start_pt, Point2D end_pt, Point2D pt_on_arc)

- Constructor -

A new span representing an arc is created within a Lua script using this contructor method

start_pt – Point2D – 2D position for start point of span
end_pt – Point2D – 2D position for end point of span- must have same Z values as start
pt_on_arc- Point2D – 2D position for a point on arc

NOTE: arcs can be a maximum of 180 degrees
e.g
 local start_pt = Point2D(0, 0)
 local end_pt = Point2D(1.0, 0)
 local pt_on_arc = Point2D(0.5, 0.3)
 local arc_span = ArcSpan(start_pt, end_pt, pt_on_arc) 

ArcSpan(Point2D start_pt, Point2D end_pt, Point2D centre_pt, bool ccw) - Constructor

A new span representing an arc is created within a Lua script using this contructor method

start_pt – Point2D – 2D position for start point of span
end_pt – Point2D – 2D position for end point of span- must have same Z values as start
centre_pt – Point2D – 2D position for centre point of arc (not mid-point)
ccw - bool - true if arc is Counter Clockwise
e.g

local start_pt = Point2D(0, 0) local end_pt = Point2D(1.0, 0) local center_pt = Point2D(0.5, 0) local arc_span = ArcSpan(start_pt, end_pt, center_pt, false)

NOTE: arcs can be a maximum of 180 degrees


ArcSpan(Point3D start_pt, Point3D end_pt, Point3D centre_pt, bool ccw) - Constructor

A new span representing an arc is created within a Lua script using this contructor method

start_pt - Point3D - 3d position for start point of span
end_pt - Point3D - 3d position for end point of span- must have same Z values as start
centre_pt - Point3D - 3d position for centre point of arc (not mid-point)
ccw - bool - true if arc is Counter Clockwise
e.g
local start_pt = Point3D(0, 0, 0)
local end_pt = Point3D(1.0, 0, 0)
local center_pt = Point3D(0.5, 0, 0)
local arc_span = ArcSpan(start_pt, end_pt, center_pt, false)
NOTE: arcs can be a maximum of 180 degrees

ArcSpan(Point3D start_pt, Point3D end_pt, Point2D pt_on_arc) - Constructor

A new span representing an arc is created within a Lua script using this contructor method

start_pt - Point3D – 3D position for start point of span
end_pt - Point3D – 3D position for end point of span- must have same Z values as start pt_on_arc- Point2D – 2D position for a point on arc
NOTE: arcs can be a maximum of 180 degrees
e.g
local start_pt = Point3D(0, 0, 0)
local end_pt = Point3D(1.0, 0, 0)
local pt_on_arc = Point2D(0.5, 0.3)
local arc_span = ArcSpan(start_pt, end_pt, pt_on_arc)

ArcSpan(Point2D start_pt, Point2D end_pt, double bulge) - Constructor

A new span representing an arc is created within a Lua script using this contructor method start_pt – Point2D – 2D position for start point of span end_pt – Point2D – 2D position for end point of span - must have same Z values as start bulge - double - buge factor for arc e.g local start_pt = Point2D(0, 0) local end_pt = Point2D(1.0, 0) local arc_span = ArcSpan(start_pt, end_pt, 1.0)

ArcSpan(Point3D start_pt, Point3D end_pt, double bulge) - Constructor

A new span representing an arc is created within a Lua script using this contructor method start_pt - Point3D – 3D position for start point of span end_pt - Point3D – 3D position for end point of span - must have same Z values as start bulge - double - buge factor for arc e.g local start_pt = Point3D(0, 0, 0) local end_pt = Point3D(1.0, 0, 0) local arc_span =

ArcSpan(start_pt, end_pt, 1.0)

NOTE: arcs can be a maximum of 180 degrees 

Properties

.Bulge

R/O - double - signed bulge for arc

.IsAntiClockwise

R/O - bool - true if arc is anticlockwise (same as .IsCCW)

.IsCCW

R/O - bool - true if arc is counter clockwise (same as . IsAntiClockwise)

.IsClockwise

R/O - bool - true if arc is clockwise (same as . IsCW )

.IsCW

R/O - bool - true if arc is clockwise (same as . IsClockwise)

Methods

:ArcMidPoint()

Returns a Point3D holding the mid point of the arc

:RadiusAndCentre(Point3D ret_centre_pt)

Calculate the centre point of the arc and the radius. The method returns the radius and also sets the position of the passed point to the centre point position of the arc. ret_centre_pt - Point3D - returned 3d position for centre point of arc (not mid-point)

Example Code local arc = ArcSpan(Point3D(0,0,0), Point3D(1,0,0), 1.0) local centre = Point3D() local radius = arc:RadiusAndCentre(centre) MessageBox("Arc Radius = " .. radius .. " Centre Point = " .. centre.x .. "," .. centre.y )

:SetBulge(bulge)

Set the bulge factor for this arc Bulge - double - bulge factor for arc

---

Global helper methods

ArcBulgeFromMidPoint(Point2D start, Point2D end, Point2D mid)

Return the bulge factor for an arc through the specified 3 points
start -Point2D -Start point for arc
end -Point2D -End point for arc
mid -Point2D -mid point for arc ( NOT centre point)
Back.jpg

References

Please Note: The base material for the contents found in this WiKi was sourced from Vectric Lua Interface for Gadgets, version 2.05, published September 12, 2018. by Vectric Ltd. Most current document from Vertric can be downloaded at Vertric Developer Information