Hi,

In a pyramid, i wanted to find the center point , area centro-id

but it doesn’t give me the center, but it create the complete 4 side shape(the reflected mirror of the triangle)

and then the center point is in the center of mirror line

Hi,

In a pyramid, i wanted to find the center point , area centro-id

but it doesn’t give me the center, but it create the complete 4 side shape(the reflected mirror of the triangle)

and then the center point is in the center of mirror line

I’m not clear on what you want but since you posted in the scripting category, I assume you are talking about the results of SurfaceAreaCentroid on your pyramid? It should give you just a point (together with a tuple of error estimations)… I don’t know where the “complete 4 sided shape” is coming from, but not from SurfaceAreaCentroid()…

–Mitch

Hi Mohamed - can you please post and example?

thanks,

-Pascal

rather than giving me a point in the center of the triangle

it give me a point on the side

i need the point in the center of the surface

i tried to use curve area centroid instead

but i dont know how to extract wireframe,

but i dont know how

i will post the whole file,

i am not sure if you are using python inside grasshopper

i am trying to do a bouncing script inside a shape, what ever its, box or pyramid,

to do that, i tried to extract the normal of each surface, and if the moving ball touched the surface( is point in surface) then it reverse its direction

but i got lost i guess,

import rhinoscriptsyntax as rs

srfCenList = []

srfUVList = []

srfNrmlList = []

pos = [0,0,0]

vel = vector

uLmt = 500

for i in range(int(time)):

```
pos = rs.VectorAdd(pos, vel)
# here a new part
for srf in srfs:
srfCenter = rs.SurfaceAreaCentroid(srf)
pt = srfCenter[0]
srfCenList.append(pt)
srfUV = rs.SurfaceClosestPoint(srf, pt)
srfUVList.append(srfUV)
srfNrml = rs.SurfaceNormal(srf,srfUV)
srfNrml = rs.VectorReverse(srfNrml)
srfNrmlList.append(srfNrml)
ptInSrf = rs.IsPointInSurface(pos,srf)
if (ptInSrf == True):
pos = rs.VectorAdd(pos, srfNrml)
for n in range(3):
vel[n] *= -1
ptMove = rs.AddPoint(pos)
```

a = "This script to bounce the ball out of the surface it touch"

b = srfs

c = srfCenList

d = srfUVList

e = srfNrmlList

print " I tried to apply that for a pyramid surface"