# -*- coding: utf-8 -*- import xc_base import geom import math pos1 = geom.Pos3d(0.5, 0, 0) ptoAplica = geom.Pos3d(5, 0, 0) vectorDir = geom.Vector3d(0, 2, 0) vec1 = geom.SlidingVector3d(ptoAplica, vectorDir) brazo = vec1.getOrg().x - pos1.x m = vec1.getMomentPos3d(pos1) fuerza = vec1.y mTeor = fuerza * brazo import os fname = os.path.basename(__file__) if m.x == 0 and m.y == 0 and m.z == mTeor: print "test ", fname, ": ok." else: print "test ", fname, ": ERROR."
# -*- coding: utf-8 -*- import xc_base import geom import math pto = geom.Pos3d(0, 0, 0) vectorDir = geom.Vector3d(1, 2, 3) vec1 = geom.SlidingVector3d(pto, vectorDir) import os fname = os.path.basename(__file__) if vec1.x == 1 and vec1.y == 2 and vec1.z == 3: print "test ", fname, ": ok." else: print "test ", fname, ": ERROR."
# -*- coding: utf-8 -*- from __future__ import print_function import xc_base import geom # Define sliding vector system svd1 = geom.SlidingVectorsSystem3d() # Defina a sliding vector. ptoAplic = geom.Pos3d(1, 1, 0) testVector = geom.Vector3d(0, 0, 1) vec = geom.SlidingVector3d(ptoAplic, testVector) svd1 += vec # add it to the system. # Another sliding vector. ptoAplic = geom.Pos3d(-1, 1, 0) vec = geom.SlidingVector3d(ptoAplic, testVector) svd1 += vec # add it to the system. # And another one ptoAplic = geom.Pos3d(-1, -1, 0) vec = geom.SlidingVector3d(ptoAplic, testVector) svd1 += vec # add it to the system # Again... ptoAplic = geom.Pos3d(1, -1, 0) vec = geom.SlidingVector3d(ptoAplic, testVector) svd1 += vec # add it to the system Res = svd1.getResultant() Mom = svd1.getMoment()
# -*- coding: utf-8 -*- import xc_base import geom import math ptoOrigen=geom.Pos3d(0.5,0,0) ptoDest=geom.Pos3d(0.5,0,100) r1=geom.Line3d(ptoOrigen,ptoDest) vdir=r1.getVDir() tp=r1.tipo() pto_aplic=geom.Pos3d(5,0,0) vectorDir=geom.Vector3d(0,2,0) vec1=geom.SlidingVector3d(pto_aplic,vectorDir) pto=vec1.getOrg() brazo=pto.distLine3d(r1) fuerza=vec1.y m=vec1.getMomentLine3d(r1) mTeor=fuerza*brazo ratio1=(m-mTeor)/mTeor import os fname= os.path.basename(__file__) if m==mTeor: print "test ",fname,": ok." else: print "test ",fname,": ERROR."
# -*- coding: utf-8 -*- from __future__ import print_function import xc_base import geom svd1 = geom.SlidingVectorsSystem3d() ptoAplic = geom.Pos3d(1, 1, 0) vectorDir = geom.Vector3d(0, 0, 1) vec = geom.SlidingVector3d(ptoAplic, vectorDir) svd1 += vec ptoAplic = geom.Pos3d(-1, 1, 0) vec = geom.SlidingVector3d(ptoAplic, vectorDir) svd1 += vec ptoAplic = geom.Pos3d(-1, -1, 0) vec = geom.SlidingVector3d(ptoAplic, vectorDir) svd1 += vec ptoAplic = geom.Pos3d(1, -1, 0) vec = geom.SlidingVector3d(ptoAplic, vectorDir) svd1 += vec Res = svd1.getResultant() Mom = svd1.getMoment() #It seems there is a bug in svd.getResultant() it returns a SlidingVectorsSystem3d instead of a Vector3d. #print('type<Res>= ', type(Res)) #print('Res= ', Res) import os fname = os.path.basename(__file__) if Res.x == 0 and Res.y == 0 and Res.z == 4 and Mom.x == 0 and Mom.y == 0 and Mom.z == 0: print("test ", fname, ": ok.") else: