def _getCentroid(self): Cy=0. Cx1,Cz,A1=miscTools.polyCentroid(self.sideProfile_X,self.sideProfile_Y) Cx2,Cy2,A2=miscTools.polyCentroid(self.topProfile_X,self.topProfile_Y) A1=numpy.abs(A1) A2=numpy.abs(2.*A2) Cx=(A1*Cx1+A2*Cx2)/(A1+A2) self.centroid=numpy.array([Cx,Cy,Cz])
def _getCentroid(self): xLE=self.segCoords[0] yLE=self.segCoords[1] xTE=xLE+self.chords[::-1] yTE=yLE x=numpy.concatenate((xLE,xTE[::-1])) y=numpy.concatenate((yLE,yTE[::-1])) Cx,Cy,A=miscTools.polyCentroid(x,y) b=numpy.cumsum(self.segmentSpans) Cz=0.0 i=find(b>Cy)[0]-1 R=(Cy-b[i])/(b[i+1]-b[i]) Cz=R*self.segCoords[2][i]+(1.-R)*self.segCoords[2][i+1] if self.vertical: self.centroid = numpy.array([Cx,0.0,Cy+self.aapex[2]]) else: self.centroid=numpy.array([Cx,Cy,Cz])