Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error intersecting polyhedra

I have a dictionary of polyhedra which I want to consider various intersections and unions of. For now, my dictionary has four polyhedra in it. When running the following for loop:

poly_int = Polyhedron([b[key] for key in b.keys()]) # this is a tetrahedron containing
# all of my polyhedra
for i in [1,2,3,4]:
  poly_int = poly[i] & poly_int

I get a very nasty error:

AttributeError: 'Polyhedra_RDF_cdd_with_category.element_class'
object has no attribute '_Vrepresentation'

(The traceback for the error is quite long. I can include it if needed.)

Manually computing

poly[1] & poly[2] & poly[3] & poly[4]

gives the same error. HOWEVER, if instead I compute

(poly[1] & poly[2]) & (poly[3] & poly[4])

I get no errors. While this is a fine workaround for this particular case, I'm scripting these intersections and need some way to actually compute these intersections automatically. Using something like

poly[1].intersection(poly[2]) # etc.

doesn't help either. Any thoughts?

click to hide/show revision 2
included definition of b

Error intersecting polyhedra

I have a dictionary of polyhedra which I want to consider various intersections and unions of. For now, my dictionary has four polyhedra in it. When running the following for loop:

v={} # contains coordinates of the tetrahedron, centered at (0,0,0)
v[1] = vector([1,0,-1/sqrt(2)])
v[2] = vector([-1,0,-1/sqrt(2)])
v[3] = vector([0,1,1/sqrt(2)])
v[4] = vector([0,-1,1/sqrt(2)])

V = {1,2,3,4}

b={} # will contain coordinates of vertices of the subdivision of the tetrahedron

for X in powerset(V):
  q = len(X)
  if q > 0:
    b[tuple(X)] = (1/q)*sum([v[i] for i in X])

poly_int = Polyhedron([b[key] for key in b.keys()]) # this is a tetrahedron containing
# all of my polyhedra
for i in [1,2,3,4]:
  poly_int = poly[i] & poly_int

I get a very nasty error:

AttributeError: 'Polyhedra_RDF_cdd_with_category.element_class'
object has no attribute '_Vrepresentation'

(The traceback for the error is quite long. I can include it if needed.)

Manually computing

poly[1] & poly[2] & poly[3] & poly[4]

gives the same error. HOWEVER, if instead I compute

(poly[1] & poly[2]) & (poly[3] & poly[4])

I get no errors. While this is a fine workaround for this particular case, I'm scripting these intersections and need some way to actually compute these intersections automatically. Using something like

poly[1].intersection(poly[2]) # etc.

doesn't help either. Any thoughts?

click to hide/show revision 3
retagged

Error intersecting polyhedra

I have a dictionary of polyhedra which I want to consider various intersections and unions of. For now, my dictionary has four polyhedra in it. When running the following for loop:

v={} # contains coordinates of the tetrahedron, centered at (0,0,0)
v[1] = vector([1,0,-1/sqrt(2)])
v[2] = vector([-1,0,-1/sqrt(2)])
v[3] = vector([0,1,1/sqrt(2)])
v[4] = vector([0,-1,1/sqrt(2)])

V = {1,2,3,4}

b={} # will contain coordinates of vertices of the subdivision of the tetrahedron

for X in powerset(V):
  q = len(X)
  if q > 0:
    b[tuple(X)] = (1/q)*sum([v[i] for i in X])

poly_int = Polyhedron([b[key] for key in b.keys()]) # this is a tetrahedron containing
# all of my polyhedra
for i in [1,2,3,4]:
  poly_int = poly[i] & poly_int

I get a very nasty error:

AttributeError: 'Polyhedra_RDF_cdd_with_category.element_class'
object has no attribute '_Vrepresentation'

(The traceback for the error is quite long. I can include it if needed.)

Manually computing

poly[1] & poly[2] & poly[3] & poly[4]

gives the same error. HOWEVER, if instead I compute

(poly[1] & poly[2]) & (poly[3] & poly[4])

I get no errors. While this is a fine workaround for this particular case, I'm scripting these intersections and need some way to actually compute these intersections automatically. Using something like

poly[1].intersection(poly[2]) # etc.

doesn't help either. Any thoughts?