I got this plane
我有这架飞机
from sympy.geometry.plane import Plane
p=Plane((0,5,0),(0,0,0),(5,7,0)) #2d first to make it easier
now I want to get a point on that plane 45deg from plane point one and lenght=sqrt(2). In this case that point will be (1,6,0)
现在我想从平面点1和lenght = sqrt(2)得到该平面45度的点。在这种情况下,该点将是(1,6,0)
I've tried this:
我试过这个:
a=np.sqrt(2)*p.arbitrary_point(pi/4)
but it does not work as a coordinates return (1.0,8.07106781187,0.0) the problem is that arbitrary_point returns a point in a circle of radius 1 about p1 of the Plane. I want to be able to change that radius.
但它不能作为坐标返回(1.0,8.07106781187,0.0),问题是arbitrary_point返回一个半径为1的圆关于平面p1的点。我希望能够改变那个半径。
1 个解决方案
#1
1
Multiplying all of a point's coordinates by sqrt(2) moves it away from the origin (0,0,0). You want to move it away from p1 of the plane. This is what the scale method is for.
将所有点的坐标乘以sqrt(2)将其移离原点(0,0,0)。你想把它从飞机的p1移开。这就是缩放方法的用途。
p.arbitrary_point(np.pi/4).scale(np.sqrt(2), np.sqrt(2), np.sqrt(2), p.p1)
returns Point3D(1, 6, 0)
.
返回Point3D(1,6,0)。
(I'm assuming import numpy as np
here, to match the setting of the question; the standard math
module could be used instead of numpy.)
(我假设在这里导入numpy为np,以匹配问题的设置;可以使用标准数学模块而不是numpy。)
#1
1
Multiplying all of a point's coordinates by sqrt(2) moves it away from the origin (0,0,0). You want to move it away from p1 of the plane. This is what the scale method is for.
将所有点的坐标乘以sqrt(2)将其移离原点(0,0,0)。你想把它从飞机的p1移开。这就是缩放方法的用途。
p.arbitrary_point(np.pi/4).scale(np.sqrt(2), np.sqrt(2), np.sqrt(2), p.p1)
returns Point3D(1, 6, 0)
.
返回Point3D(1,6,0)。
(I'm assuming import numpy as np
here, to match the setting of the question; the standard math
module could be used instead of numpy.)
(我假设在这里导入numpy为np,以匹配问题的设置;可以使用标准数学模块而不是numpy。)