Exemplo n.º 1
0
def figuresMaxRadius(figures):
	maxRadius=0
	for f in figuresIterator(figures):
		if f.dim==0:
			r=algebra.vectLen(f.position)
			if r>maxRadius:
				maxRadius=r
	return maxRadius
Exemplo n.º 2
0
def cutOffFaces(figure, ratio, faces):
	hyperplanes=[]
	innerPoint=algebra.vectAvg(*[v.position for v in figure if v.dim==0])
	for f in faces:
		points=[v.position for v in f if v.dim==0]
		basis=algebra.orthonormalBasisFromPoints(points)
		normal=algebra.orthogonalizeVect(algebra.vectDiff(points[0], innerPoint), basis)
		if algebra.vectLen(normal)<0.0001:
			raise RuntimeError("Cannot cut faces")
		hyperplanes.append(Hyperplane(normal, (1-ratio+algebra.dotProduct(normal, innerPoint)/algebra.vectLen(normal)**2)))
	return cutOffConvex(figure, hyperplanes, innerPoint)