MCPcopy
hub / github.com/CadQuery/cadquery / sagittaArc

Method sagittaArc

cadquery/cq.py:2116–2152  ·  view source on GitHub ↗

Draw an arc from the current point to endPoint with an arc defined by the sag (sagitta). :param endPoint: end point for the arc :type endPoint: 2-tuple, in workplane coordinates :param sag: the sagitta of the arc :type sag: float, perpendicular distance from

(
        self: T, endPoint: VectorLike, sag: float, forConstruction: bool = False,
    )

Source from the content-addressed store, hash-verified

2114 return self.newObject([arc])
2115
2116 def sagittaArc(
2117 self: T, endPoint: VectorLike, sag: float, forConstruction: bool = False,
2118 ) -> T:
2119 """
2120 Draw an arc from the current point to endPoint with an arc defined by the sag (sagitta).
2121
2122 :param endPoint: end point for the arc
2123 :type endPoint: 2-tuple, in workplane coordinates
2124 :param sag: the sagitta of the arc
2125 :type sag: float, perpendicular distance from arc center to arc baseline.
2126 :return: a workplane with the current point at the end of the arc
2127
2128 The sagitta is the distance from the center of the arc to the arc base.
2129 Given that a closed contour is drawn clockwise;
2130 A positive sagitta means convex arc and negative sagitta means concave arc.
2131 See `<https://en.wikipedia.org/wiki/Sagitta_(geometry)>`_ for more information.
2132 """
2133
2134 startPoint = self._findFromPoint(useLocalCoords=True)
2135 endPoint = Vector(endPoint)
2136 midPoint = endPoint.add(startPoint).multiply(0.5)
2137
2138 sagVector = endPoint.sub(startPoint).normalized().multiply(abs(sag))
2139 if sag > 0:
2140 sagVector.x, sagVector.y = (
2141 -sagVector.y,
2142 sagVector.x,
2143 ) # Rotate sagVector +90 deg
2144 else:
2145 sagVector.x, sagVector.y = (
2146 sagVector.y,
2147 -sagVector.x,
2148 ) # Rotate sagVector -90 deg
2149
2150 sagPoint = midPoint.add(sagVector)
2151
2152 return self.threePointArc(sagPoint, endPoint, forConstruction)
2153
2154 def radiusArc(
2155 self: T, endPoint: VectorLike, radius: float, forConstruction: bool = False,

Callers 4

radiusArcMethod · 0.95
test2DDrawingMethod · 0.80
testCloseMethod · 0.80

Calls 8

_findFromPointMethod · 0.95
addMethod · 0.95
subMethod · 0.95
threePointArcMethod · 0.95
VectorClass · 0.85
normalizedMethod · 0.80
multiplyMethod · 0.45
addMethod · 0.45

Tested by 2

test2DDrawingMethod · 0.64
testCloseMethod · 0.64