0

假设我有一个三角形并且我要在三角形的一侧画一条线,我将如何在 Maple 中创建该线撞击三角形侧面时的反射线。我只是在颜料中快速画了这个(所以它不准确)。有没有办法在枫树中做到这一点。谢谢我目前有,

with(plots):
with(plottools):

a:=polygon([[0,0],[2,0],[1,2]]):
b:=polygon([[2,0],[4,0],[3,2]]):
e:=line([2.5,2],[2.5,1]):
f:=line([2.5,1],[1.72,0.484]):

display(a,b,e,f);
4

1 回答 1

1

Let's starting direction is vector Dir (dir.x, dir.y), and side of reflection has unit normal N (n.x, n.y)

After reflection tangential component of vector is inverted and normal component remains the same. We can use equations below to calculate new direction:

dot = dir.x * n.x + dir.y * n.y

//after reflection
newdir.x = dir.x - 2 * dot * n.x
newdir.y = dir.y - 2 * dot * n.y

Apply such transformations to get a sequence of reflections from right and left triangle sides (using corresponding normals)

于 2018-03-04T14:33:23.273 回答