def pointOnsetCracking(self): '''return the calculated (strain,stress) point of the concrete diagram where cracking starts. It's obtained as the intersection of the straight line thas reproduces the linear-elastic range in tension (before cracking) with the regression line that approaches the exponential decay curve adopted for the post-cracking range ''' rgLin=self.regresLine() r1=geom.Line2d(geom.Pos2d(rgLin['interceptX'],0.),geom.Pos2d(0,rgLin['interceptY'])) r2=geom.Line2d(geom.Pos2d(0.,0.),geom.Pos2d(self.f_ct/self.E_ct,self.f_ct)) pInt=r1.getIntersectionWithLine(r2)[0] return {'eps_ct':pInt.x, 'ft':pInt.y}
def getIntersectionWith3DLine(self, p0, p1): retval = [] err = 0.0 P0proj = geom.Pos2d(p0.x, p0.y) P1proj = geom.Pos2d(p1.x, p1.y) line2d = geom.Line2d(P0proj, P1proj) proj = self.xyPline.getIntersectionWithLine(line2d) for p in proj: lmb = p.distPos2d(P0proj) / P1proj.distPos2d(P0proj) pInt = geom.LineSegment3d(p0, p1).getPoint(lmb) err = (pInt.x - p.x)**2 + (pInt.y - p.y)**2 if (err > 1e-6): print("Error finding intersection; err= ", err) print("p= ", p) print("pInt= ", pInt) print("lmb= ", lmb) else: retval.append(pInt) return retval
def getOverturningSafetyFactor(svd): svd= svd.reduceTo(foundationCenter) R= svd.getResultant() M= svd.getMoment() #Overturning safety factor. foundationPlane= geom.Line2d(geom.Pos2d(0.0,0.0), geom.Pos2d(1e3,0.0)) zml= svd.zeroMomentLine() p= foundationPlane.getIntersectionWithLine(zml)[0] # Intersection with # foundation plane. gammaR= 1.0 e= p.x-foundationCenter.x b= foundationWidth bReduced= 2*(b/2.0+e) if(e<0): F= b/(3*(-e)*gammaR) else: F= 10 print 'e= ', e, ' m' return F
def getFoundationPlane(self): ''' Returns the foundation plane.''' v = geom.Vector2d(0.0, -self.footingThickness / 2.0) toeEndPos = self.getWFToeEndPosition() + v heelEndPos = self.getWFHeelEndPosition() + v return geom.Line2d(toeEndPos, heelEndPos)
def getFootingMidPlane(self): ''' Returns the midplane of the footing.''' toeEndPos = self.getWFToeEndPosition() heelEndPos = self.getWFHeelEndPosition() return geom.Line2d(toeEndPos, heelEndPos)
# -*- coding: utf-8 -*- from __future__ import print_function import xc_base import geom import math r1=geom.Line2d(geom.Pos2d(0.,0.),geom.Pos2d(10.,0.)) r2=geom.Line2d(geom.Pos2d(0.,-2.),geom.Pos2d(10.,-2.)) r3=geom.Line2d(geom.Pos2d(0.,2.),geom.Pos2d(10.,2.)) a=r2.getParamA() b=r2.getParamB() ratio1=math.fabs(a) ratio2=math.fabs(b+2) a=r3.getParamA() b=r3.getParamB() ratio3=math.fabs(a) ratio4=math.fabs(b-2) import os fname= os.path.basename(__file__) if ratio1<1e-15 and ratio2<1e-15 and ratio3<1e-15 and ratio4<1e-15 : print("test ",fname,": ok.") else: print("test ",fname,": ERROR.")
# -*- coding: utf-8 -*- '''Compute the intersection of two straight lines.''' from __future__ import print_function import xc_base import geom import math r1 = geom.Line2d(geom.Pos2d(1., 0.), geom.Pos2d(1., 1.)) r2 = geom.Line2d(geom.Pos2d(0., 1.), geom.Pos2d(1., 1.)) #In lines doesn't intersect the list well be empty. p = r1.getIntersectionWithLine(r2)[0] ratio1 = math.fabs(p.x - 1.0) ratio2 = math.fabs(p.y - 1.0) ''' print('p= ', p) print('ratio1= ', ratio1) print('ratio2= ', ratio2) ''' import os fname = os.path.basename(__file__) if ratio1 < 1e-20 and ratio2 < 1e-20: print("test ", fname, ": ok.") else: print("test ", fname, ": ERROR.")
# -*- coding: utf-8 -*- '''Compute the intersection of a line with a segment.''' from __future__ import print_function import xc_base import geom import math s = geom.Segment2d(geom.Pos2d(0.443, 0.), geom.Pos2d(0.443, 0.443)) r = geom.Line2d(geom.Pos2d(1.0, 0.0116016), geom.Pos2d(-4735.73, 0.0116019)) #In lines doesn't intersect the list well be empty. p = s.getIntersectionWithLine(r)[0] ratio1 = math.fabs(p.x - 0.443) ratio2 = math.fabs(p.y - 0.0116016) ''' print('p= ', p) print('ratio1= ', ratio1) print('ratio2= ', ratio2) ''' import os fname = os.path.basename(__file__) if ratio1 < 1e-20 and ratio2 < 1e-10: print("test ", fname, ": ok.") else: print("test ", fname, ": ERROR.")