← Back to team overview

yade-users team mailing list archive

Re: [Question #690438]: How to generate a regular dodecahedron in polyhedra_utils module?

 

Question #690438 on Yade changed:
https://answers.launchpad.net/yade/+question/690438

    Status: Answered => Open

weijie is still having a problem:
Hi Vasileios, and thank you again.

I created the dodecahedron according to the reference, but I encountered difficulties in scaling. In my code below, when d = 1, it is the regular dodecahedron in the reference, and its edge length is √5 − 1. When the edge length of the regular dodecahedron I want to create is 9, how should the coordinates change?
Following is my code:
################################
from yade import polyhedra_utils,pack,plot,utils,export,qt,ymport
import numpy as np
import math
import random
n = PolyhedraMat(young=7.2e7,poisson=.2,density=2.5e3)   
O.materials.append(n) 
a=(1+math.sqrt(5))/2
d=1
v1=(d,d,d),(d,d,-d),(d,-d,d),(d,-d,-d),(-d,d,d),(-d,d,-d),(-d,-d,d),(-d,-d,-d)
v2=(0,a,1/a),(0,a,-1/a),(0,-a,1/a),(0,-a,-1/a)
v3=(1/a,0,a),(1/a,0,-a),(-1/a,0,a),(-1/a,0,-a)
v4=(a,1/a,0),(a,-1/a,0),(-a,1/a,0),(-a,-1/a,0)
v=((d,d,d),(d,d,-d),(d,-d,d),(d,-d,-d),(-d,d,d),(-d,d,-d),(-d,-d,d),(-d,-d,-d),(0,a,1/a),(0,a,-1/a),(0,-a,1/a),(0,-a,-1/a),(1/a,0,a),(1/a,0,-a),(-1/a,0,a),(-1/a,0,-a),(a,1/a,0),(a,-1/a,0),(-a,1/a,0),(-a,-1/a,0))
#print(v)
b = polyhedra_utils.polyhedra(material=n,v=v,fixed=True,color=(0,0,120))
O.bodies.append(b)

from yade import qt
v=qt.View()
v.sceneRadius=10.0
########################

Best regards,
Jie

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.