# make a zonogon with 5 generators
pz20 = polarzonogon( 20, 5 )
# make 4 random directions
set.seed(0)
dir = matrix(rnorm(4*2),4,2)
# use basepoint in the interior of the zonogon
raytrace( pz20, c(0.5,0.5), dir )
# base.1 base.2 direction.1 direction.2 facetidx sign tmax boundary.1 boundary.2 timetrace
# 1 0.5 0.5 1.2629543 0.4146414 4 -1 2.0503073 3.08944438 1.35014236 7.680000e-05
# 2 0.5 0.5 -0.3262334 -1.5399500 1 -1 0.3246859 0.39407664 0.00000000 4.649995e-05
# 3 0.5 0.5 1.3297993 -0.9285670 2 -1 0.4868719 1.14744192 0.04790678 4.310103e-05
# 4 0.5 0.5 1.2724293 -0.2947204 2 -1 0.9354693 1.69031851 0.22429808 4.149997e-05
# use basepoint at 0 - on the boundary of the zonogon
raytrace( pz20, c(0,0), dir )
# base.1 base.2 direction.1 direction.2 facetidx sign tmax boundary.1 boundary.2 timetrace
# 1 0 0 1.2629543 0.4146414 4 -1 2.192481 2.7690037 0.9090936 0.0001216
# 2 0 0 -0.3262334 -1.5399500 NA NA NA NA NA NA
# 3 0 0 1.3297993 -0.9285670 NA NA NA NA NA NA
# 4 0 0 1.2724293 -0.2947204 NA NA NA NA NA NA
Run the code above in your browser using DataLab