#!/usr/bin/perl -w
use strict;
use v5.10;
use Math::Trig;
my $oo;
for my $i (0..20) {
# construct a line on the X axis and a perpendicular bisector.
# make a point on the bisector 20 units from the intersection.
my $d = 20;
# let us cast rays from the point to the line
# let's say we want to sample a 20 degree area of the line.
# let's see how far apart the samples will be on the line given a
# fixed angle increment.
my $a = $i - 10; # we sample from 10° left to 10° right
my $o = $d * tan(deg2rad($a));
say +($oo - $o) . " X delta" if defined $oo;
$oo = $o;
}
say "notice that the distances between the sample points on the near frustum";
say "plane are not equidistant to each other. we need to correct for that.";
# construct a line and a perpendicular bisector.
# make a point on the bisector 20 units from the intersection.
my $d = 20;
# let us cast rays from the point to the line
# let's say we want to sample a 20 degree area of line.
# let's enforce a fixed distance between points on the instead of
# a fixed angle between sampled points.
my $s = $d * tan(deg2rad(-10));
my $o = $s / 10;
my $ot;
for (my $a = $s; $a < -$s; $a -= $o) {
my $t = rad2deg(atan2($a, $d));
say +($t - $ot) . " degree delta" if defined $ot;
$ot = $t;
}
say "notice that the *angles* between the sample points on the near frustum";
say "plane are now not the same, but the sample points on the near frustum";
say "are enforced to be equidistant to each other.";