Graphics-Penplotter-GcodeXY

 view release on metacpan or  search on metacpan

t/16-ana.t  view on Meta::CPAN

    ok abs($cfg{ex} - 5.0) < 1e-9,         'build_config: default ex=5';
    ok abs($cfg{ey} - 0.0) < 1e-9,         'build_config: default ey=0';
    ok abs($cfg{ez} - 5.0) < 1e-9,         'build_config: default ez=5';

    # phi_fwd should point from (5,0) toward (0,0): that is angle pi
    ok abs($cfg{phi_fwd} - $PI) < 1e-9,    'build_config: phi_fwd=pi for default obs';

    # ang_rad: 2*asin(1/5)*0.9 ~ 2*0.20136*0.9 ~ 0.36245
    my $expected_ang = 2.0 * atan2(0.2, sqrt(1-0.04)) * 0.90;
    ok abs($cfg{ang_rad} - $expected_ang) < 1e-6,
                                            'build_config: default ang_rad matches formula';

    # beta0 = atan2(H, D) = atan2(5,5) = pi/4
    ok abs($cfg{beta0} - $PI/4) < 1e-9,    'build_config: beta0=pi/4 for H=D';

    # elev_rad = beta0 * 0.8
    ok abs($cfg{elev_rad} - $PI/4 * 0.8) < 1e-9,
                                            'build_config: elev_rad=beta0*0.8';

    # Custom obs_angle=90 (observer from +y direction)
    my %cfg2 = ana('_ana_build_config', 0,0, 1, obs_angle => 90);



( run in 0.379 second using v1.01-cache-2.11-cpan-483215c6ad5 )