Find the intersection of a line with a plane: Difference between revisions
Find the intersection of a line with a plane (view source)
Revision as of 10:08, 6 January 2023
, 1 year ago→With a geometric algebra library: simplify and add module version import requirement
(→With a geometric algebra library: correction) |
(→With a geometric algebra library: simplify and add module version import requirement) |
||
Line 1,491:
See task [[geometric algebra]]
<syntaxhighlight lang=raku>use Clifford:ver<6.2.1>;
# We pick a (non-degenerate) projective basis and
# we define the dual and meet operators.
my $I = [∧] my ($i, $j, $k, $l) = @e;
sub prefix:<∗>($M) { $M/$I }
sub infix:<∨>($A, $B) { ∗((∗$B)∧(∗$A)) }
my $direction = -$j - $k;
# Homogeneous coordinates of (X, Y, Z) are (X, Y, Z, 1)
Line 1,508:
# A plane is a trivector
my $plane = (5*$k + $l) ∧ ($k*-
# The intersection is the meet
▲my $LINE = $line*$I/$I2;
# Affine coordinates of (X, Y, Z, W) are (X/W, Y/W, Z/W)
say $m/($m·$l)
{{out}}
<pre>(0 -5 5)</pre>
|