Provide parametric equations of curves.
Signature | Description |
---|---|
circle(t,radius) |
The parametric equation of a circle. |
logarithmicSpiral(t[,a,k]) |
The parametric equation of a logarithmic spiral. |
archimedeanSpiral(t,a,b) |
The parametric equation of a archimedean spiral. |
squircle(t,radius,s) |
(Preview) The parametric equation of a squircle. |
egg(t,a[,c]) |
(Preview) The parametric equation of a Egg Shaped Curve III. |
superellipse(t,n[,a,b]) |
The parametric equation of a superellipse. |
superformula(t,m,n1,n2,n3[,a,b]) |
The parametric equation of a superformula. |
Signature | Description |
---|---|
helix(t,radius,slope) |
The parametric equation of a helix. |
sphericalSpiral(t,radius[,c]) |
The parametric equation of a spherical spiral. |
torusKnot(t,p,q) |
The parametric equation of a (p,q)-torus knot. |
lemniscateGerono(t[,a,b,c]) |
(Preview) The parametric equation of a Lemniscate of Gerono. |
parametricEquation(func[,*args,**kwargs]) |
Convert func into a function f(t) used by Workplane.parametricCurve . |
The parametric equation of a circle.
t
: a parametric variable in the range 0 to 1.radius
: circle radius.
from cqmore import Workplane
from cqmore.curve import circle
radius = 1
c = (Workplane()
.parametricCurve(lambda t: circle(t, radius))
.center(radius * 3, 0)
.polyline([circle(t / 10, radius) for t in range(6)]).close()
.extrude(1)
)
The parametric equation of a logarithmic spiral. Default to a golden spiral.
t
: as it increases, the point traces a right-handed spiral about the z-axis, in a right-handed coordinate system.a = 1
: the a parameter of the logarithmic spiral.k = 0.306349
: the k parameter of the logarithmic spiral.
from cqmore import Workplane
from cqmore.curve import logarithmicSpiral
spiral = (Workplane()
.polyline([logarithmicSpiral(t / 360) for t in range(360 * 5)])
)
The parametric equation of a archimedean spiral.
t
: as it increases, the point traces a right-handed spiral about the z-axis, in a right-handed coordinate system.a
: move the centerpoint of the spiral outward from the origin.b
: control the distance between loops.
from cqmore import Workplane
from cqmore.curve import archimedeanSpiral
spiral = (Workplane()
.polyline([archimedeanSpiral(t / 360, 1, 1) for t in range(360 * 5)])
)
The parametric equation of a squircle.
t
: a parametric variable in the range 0 to 1.s
: the squareness parameter in the range 0 to 1.
from cqmore import Workplane
from cqmore.curve import squircle
r = 10
r1 = Workplane()
for i in range(0, 6):
r1 = (r1.center(r * 3, 0)
.parametricCurve(lambda t: squircle(t, r, i / 5))
.extrude(1)
)
The parametric equation of a Egg Shaped Curve III.
t
: a parametric variable in the range 0 to 1.a
: roughly the radius at the big end.c = 2
:a * c
is the length between ends.
from cqmore import Workplane
from cqmore.curve import egg
radius = 1
c1 = (Workplane()
.parametricCurve(lambda t: egg(t, radius, c = 2))
.center(radius * 2.5, 0)
.parametricCurve(lambda t: egg(t, radius, c = 2.5))
.center(radius * 3, 0)
.parametricCurve(lambda t: egg(t, radius, c = 3))
.extrude(1)
)
The parametric equation of a superellipse.
t
: a parametric variable in the range 0 to 1.n
: the n parameter of the superellipse.a = 1
: the a parameter of the superellipse.b = 1
: the b parameter of the superellipse.
from cqmore import Workplane
from cqmore.curve import superellipse
r1 = Workplane()
for i in range(3, 10):
r1 = (r1.center(3, 0)
.parametricCurve(lambda t: superellipse(t, i / 5), N = 20)
.extrude(1)
)
The parametric equation of a superformula.
t
: a parametric variable in the range 0 to 1.m
: the m parameter of the superformula.n1
: the n1 parameter of the superformula.n2
: the n2 parameter of the superformula.n3
: the n3 parameter of the superformula.a = 1
: the a parameter of the superformula.b = 1
: the b parameter of the superformula.
from cqmore import Workplane
from cqmore.curve import superformula
params = [
[3, 4.5, 10, 10],
[4, 12, 15, 15],
[7, 10, 6, 6],
[5, 4, 4, 4],
[5, 2, 7, 7]
]
r1 = Workplane()
for i in range(5):
r1 = (r1.center(4, 0)
.parametricCurve(lambda t: superformula(t, *params[i]))
.extrude(1)
)
The parametric equation of a helix.
t
: as it increases, the point traces a right-handed helix about the z-axis, in a right-handed coordinate system.radius
: the helix radius.slope
: the helix slope.
from cqmore import Workplane
from cqmore.curve import helix
radius = 1
slope = 1
c = (Workplane()
.parametricCurve(lambda t: helix(t, radius, slope), stop = 3)
)
The parametric equation of a spherical spiral.
t
: a parametric variable in the range 0 to 1.radius
: the sphere radius.c = 2
: equal to twice the number of turns.
from cqmore import Workplane
from cqmore.curve import sphericalSpiral
radius = 10
c = 10
spiral = (Workplane()
.parametricCurve(lambda t: sphericalSpiral(t, radius, c))
)
The parametric equation of a torus knot.
t
: a parametric variable in the range 0 to 1.p
: the p parameter of the (p,q)-torus knot.q
: the q parameter of the (p,q)-torus knot.
from cqmore import Workplane
from cqmore.curve import torusKnot
p = 11
q = 13
c = (Workplane()
.polyline([torusKnot(t / 360, p, q) for t in range(360)])
.close()
)
The parametric equation (a * sin(φ), b * sin(φ) * cos(φ) , c * cos(φ)) of a Lemniscate of Gerono.
t
: a parametric variable in the range 0 to 1.a
: the a parameter of the Lemniscate of Gerono.b
: the b parameter of the Lemniscate of Gerono.c
: the c parameter of the Lemniscate of Gerono.
from cqmore import Workplane
from cqmore.curve import lemniscateGerono
r = (Workplane()
.parametricCurve(lambda t: lemniscateGerono(t)))
Convert func
into a function f(t) used by Workplane.parametricCurve
.
func
: the parametric equation of a curve.*args
: the positional arguments.**kwargs
: the keyword arguments.
from cqmore import Workplane
from cqmore.curve import torusKnot, parametricEquation
p = 4
q = 9
c = (Workplane()
.parametricCurve(parametricEquation(torusKnot, p = p, q = q))
)