ArcSpan: Difference between revisions

From SDK
Jump to navigation Jump to search
No edit summary
No edit summary
Line 3: Line 3:
== Constructors ==
== Constructors ==


== ArcSpan(Point2D start_pt, Point2D end_pt, Point2D pt_on_arc) ==  
=== ArcSpan(Point2D start_pt, Point2D end_pt, Point2D pt_on_arc) ===  
  - Constructor -
  - Constructor -
A new span representing an arc is created within a Lua script using this contructor method
A new span representing an arc is created within a Lua script using this contructor method
Line 9: Line 9:
end_pt – Point2D – 2D position for end point of span- must have same Z values as start
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
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)
::''NOTE: arcs can be a maximum of 180 degrees
local pt_on_arc = Point2D(0.5, 0.3)
::''e.g
local arc_span = ArcSpan(start_pt, end_pt, pt_on_arc)
::''local start_pt = Point2D(0, 0)
ArcSpan(Point2D start_pt, Point2D end_pt, Point2D centre_pt, bool ccw) - Constructor
::''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
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
::''start_pt – Point2D – 2D position for start point of span
centre_pt – Point2D – 2D position for centre point of arc (not mid-point)
::''end_pt – Point2D – 2D position for end point of span- must have same Z values as start
ccw - bool - true if arc is Counter Clockwise
::''centre_pt – Point2D – 2D position for centre point of arc (not mid-point)
e.g
::''ccw - bool - true if arc is Counter Clockwise
local start_pt = Point2D(0, 0)
 
local end_pt = Point2D(1.0, 0)
::''e.g
local center_pt = Point2D(0.5, 0)
::''local start_pt = Point2D(0, 0)
local arc_span = ArcSpan(start_pt, end_pt, center_pt, false)
::''local end_pt = Point2D(1.0, 0)
NOTE: arcs can be a maximum of 180 degrees
::''local center_pt = Point2D(0.5, 0)
96
::''local arc_span = ArcSpan(start_pt, end_pt, center_pt, false)
ArcSpan(Point3D start_pt, Point3D end_pt, Point3D centre_pt, bool ccw) - Constructor
 
::''NOTE: arcs can be a maximum of 180 degrees
::''96
 
=== 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
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
::''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
::''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)
::''centre_pt - Point3D - 3d position for centre point of arc (not mid-point)
ccw - bool - true if arc is Counter Clockwise
::''ccw - bool - true if arc is Counter Clockwise
e.g
::''e.g
local start_pt = Point3D(0, 0, 0)
::''local start_pt = Point3D(0, 0, 0)
local end_pt = Point3D(1.0, 0, 0)
::''local end_pt = Point3D(1.0, 0, 0)
local center_pt = Point3D(0.5, 0, 0)
local center_pt = Point3D(0.5, 0, 0)
local arc_span = ArcSpan(start_pt, end_pt, center_pt, false)
local arc_span = ArcSpan(start_pt, end_pt, center_pt, false)
Line 98: Line 112:
Bulge - double - bulge factor for arc
Bulge - double - bulge factor for arc
98
98
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
== Global helper methods ==
end -Point2D -End point for arc
 
mid -Point2D -mid point for arc ( NOT centre point)
=== 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)

Revision as of 19:59, 3 August 2021

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
96

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) 97 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 98

---

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)