0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

sympyのCrossとplaneのnormal_vectorを調べてみた。

Last updated at Posted at 2021-11-11

教えて下さい。こうゆうのは、「右手系」というのですか?

オリジナル

Pycharmで

# O(0,0,0),A(1,0,0),B(0,1,0),C(0,0,2)
from sympy import *
def myPtoM(myPoint3D):
    return Matrix([myPoint3D.x,myPoint3D.y,myPoint3D.z])
def myMtoP(myMatrix):
    return Point3D(myMatrix[0],myMatrix[1],myMatrix[2])
def myHtoP(myHairetu):
    return Point3D(myHairetu[0],myHairetu[1],myHairetu[2])
def myCrosstoP(P1,P2):
    return myMtoP(myPtoM(P1).cross(myPtoM(P2)))
def myDot(P1,P2):
    return myPtoM(P1).dot(myPtoM(P2))
PO=Point3D(0,0,0)
PA=Point3D(1,0,0)
PB=Point3D(0,1,0)
PC=Point3D(0,0,2)
PI=Point3D(1/4,1/4,1/4)
print("#OA→OB",myCrosstoP(PA-PO,PB-PO))
print("#OB→OA",myCrosstoP(PB-PO,PA-PO))
print("#OAB  ",myHtoP(Plane(PO,PA,PB).normal_vector))
print("#OBA  ",myHtoP(Plane(PO,PB,PA).normal_vector))
# OA→OB Point3D(0, 0, 1)
# OB→OA Point3D(0, 0, -1)
# OAB   Point3D(0, 0, 1)
# OBA   Point3D(0, 0, -1)

余計なコードが入っていました。関数を使わずに、クラスの使い方をアドバイスいただけると助かります。

目的

三角形の内心はincenterがありますが、三角錐の内接球が、目標です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?