[Solved] triangular pyramid, trigonal pyramid offset-3d-Plane-Intersection By vbasolver


I check

from sympy import *
var('m')
def myUnitVector(myPoint3D):
    myL=myPoint3D.distance((0, 0))
    return Point3D(myPoint3D.x/myL,myPoint3D.y/myL,myPoint3D.z/myL)
def myHtoP(myHairetu):
    return Point3D(myHairetu[0],myHairetu[1],myHairetu[2])
def my3PLaneIntersection(PTO,PTA,PTB,PTC,RA,RB,RC):
    vA =myUnitVector(myHtoP(Plane(PTO, PTB, PTC).normal_vector))
    PLA=Plane(PTO + RA * vA, normal_vector=vA)
    vB =myUnitVector(myHtoP(Plane(PTO, PTC, PTA).normal_vector))
    PLB=Plane(PTO + RB * vB, normal_vector=vB)
    vC =myUnitVector(myHtoP(Plane(PTO, PTA, PTB).normal_vector))
    PLC=Plane(PTO + RC * vC, normal_vector=vC)
    return PLC.intersection(PLB.intersection(PLA)[0])
def myProjection(PTO,PTA,PTC,PTOO):
    v = myUnitVector(myHtoP(Plane(PTO, PTA, PTC).normal_vector))
    return solve(PTOO - Plane(PTO, PTA, PTC).projection(PTOO) - m * v, m)[m] * (-1)
PTO,PTA,PTB,PTC=Point3D(0,0,0),Point3D(1,0,0),Point3D(0,1,0),Point3D(0,0,2)
myRO,myRA,myRB,myRC=-1/4,-1/4,-1/4,-1/4
PTOO= my3PLaneIntersection(PTO, PTA,PTB,PTC,myRO,myRO,myRO)[0]
PTAA= my3PLaneIntersection(PTA, PTC,PTB,PTO,myRA,myRA,myRA)[0]
PTBB= my3PLaneIntersection(PTB, PTC,PTO,PTA,myRB,myRB,myRB)[0]
PTCC= my3PLaneIntersection(PTC, PTB,PTA,PTO,myRC,myRC,myRC)[0]
print("#",PTOO,"\n#",PTAA,"\n#",PTBB,"\n#",PTCC,)
print("#",myProjection(PTO,PTB,PTA,PTOO),
          myProjection(PTO,PTA,PTC,PTOO),
          myProjection(PTO,PTC,PTB,PTOO))
print("#",myProjection(PTA,PTO,PTB,PTAA),
          myProjection(PTA,PTC,PTO,PTAA),
          myProjection(PTA,PTB,PTC,PTAA))
print("#",myProjection(PTB,PTA,PTO,PTBB),
          myProjection(PTB,PTO,PTC,PTBB),
          myProjection(PTB,PTC,PTA,PTBB))
print("#",myProjection(PTC,PTO,PTA,PTCC),
          myProjection(PTC,PTB,PTO,PTCC),
          myProjection(PTC,PTA,PTB,PTCC))
# Point3D(-1/4, -1/4, -1/4) 
# Point3D(7/4, -1/4, -1/4) 
# Point3D(-1/4, 7/4, -1/4) 
# Point3D(-1/4, -1/4, 15/4)
# -1/4 -1/4 -1/4
# -1/4 -1/4 -1/4
# -1/4 -1/4 -1/4
# -1/4 -1/4 -1/4

1

solved triangular pyramid, trigonal pyramid offset-3d-Plane-Intersection By vbasolver