How to use the zencad.util.points function in zencad

To help you get started, we’ve selected a few zencad examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mirmik / zencad / zencad / geom / curve3.py View on Github external
def interpolate(pnts, tangs=[], closed=False):
    return pyservoce.interpolate_curve3(points(pnts), vectors(tangs), closed)
github mirmik / zencad / zencad / platonic.py View on Github external
def hexahedron(r=1, a=None, shell=False):
	if a is None:
		a = r / math.sqrt(3) * 2

	he = a * 1 / 2;        # half the edge length

	return zencad.polyhedron(
		pnts=points([
			[-he, -he, -he],  # 0
			[-he, -he,  he],  # 1
			[-he,  he, -he],  # 2
			[-he,  he,  he],  # 3
			[ he, -he, -he],  # 4
			[ he, -he,  he],  # 5
			[ he,  he, -he],  # 6
			[ he,  he,  he],  # 7
		]),
		faces=[
			[0, 1, 3, 2],
			[4, 5, 7, 6],
			[2, 3, 7, 6],
			[0, 1, 5, 4],
			[0, 2, 6, 4],
			[1, 3, 7, 5],
github mirmik / zencad / zencad / geom / prim2d.py View on Github external
def interpolate2(lst, degmin=3, degmax=7):

    if isinstance(lst[0][0], pyservoce.point3):
        return pyservoce.interpolate2(lst, degmin=degmin, degmax=degmax)
    else:   
        lst = [ points(l) for l in lst ]
        return pyservoce.interpolate2(lst, degmin=degmin, degmax=degmax)
github mirmik / zencad / zencad / geom / prim3d.py View on Github external
def polyhedron(pnts, faces, shell=False):
    pnts = points(pnts)
    shl = pyservoce.polyhedron_shell(pnts, faces)

    if shell:
        return shl
    else:
        return shl.fill()
github mirmik / zencad / zencad / platonic.py View on Github external
def octahedron(r=1, a=None, shell=False):
	if a is None:
		a = r / math.sqrt(2) * 2

	he = a * 1 / 2;       # half the edge length
	c = a * math.sqrt(2) / 2;  # circumsphere radius

	return zencad.polyhedron(
		pnts=points([
			[  0,   0,  c],  # 0: top
			[-he,  he,  0],  # 1: front left
			[ he,  he,  0],  # 2: front right
			[ he, -he,  0],  # 3: rear right
			[-he, -he,  0],  # 4: rear left
			[  0,   0, -c],  # 5: bottom
		]),
		faces=[
			[1, 0, 2],  # top front
			[2, 0, 3],  # top right
			[3, 0, 4],  # top rear
			[4, 0, 1],  # top left
			[5, 1, 2],  # bottom front
			[5, 2, 3],  # bottom right
			[5, 3, 4],  # bottom rear
			[4, 1, 5],  # bottom left
github mirmik / zencad / zencad / geom / prim1d.py View on Github external
def polysegment(lst, closed=False):
	return pyservoce.polysegment(points(lst), closed)
github mirmik / zencad / zencad / geom / prim1d.py View on Github external
def bezier(pnts, weights=None):
	"""Построение дуги круга по трем точкам"""
	pnts = points(pnts)

	if weights:
		return pyservoce.bezier(pnts, weights)
	else:
		return pyservoce.bezier(pnts)
github mirmik / zencad / zencad / geom / prim2d.py View on Github external
def polygon(pnts, wire=False):
    if wire:
        return pyservoce.polysegment(points(pnts), True)
    else:
        return pyservoce.polygon(points(pnts))
github mirmik / zencad / zencad / geom / prim1d.py View on Github external
def bspline(pnts, knots, muls, degree, periodic=False, check_rational=True, weights=None):
	"""Построение дуги круга по трем точкам"""
	pnts = points(pnts)

	if weights:
		return pyservoce.bspline(
			pnts=pnts, 
			knots=knots,
			weights=weights,
			multiplicities=muls,
			degree=degree,
			periodic=periodic,
			check_rational=check_rational)
	else:
		return pyservoce.bspline(
			pnts=pnts, 
			knots=knots,
			multiplicities=muls,
			degree=degree,