DEFAULT_MAX_PLAYER <- 11 DEFAULT_PITCH_LENGTH <- 105.0 DEFAULT_PITCH_WIDTH <- 70.0 DEFAULT_PITCH_MARGIN <- 5.0 DEFAULT_CENTER_CIRCLE_R <- 9.15 DEFAULT_PENALTY_AREA_LENGTH <- 16.5 DEFAULT_PENALTY_AREA_WIDTH <- 40.32 DEFAULT_PENALTY_CIRCLE_R <- 9.15 DEFAULT_PENALTY_SPOT_DIST <- 11.0 DEFAULT_GOAL_AREA_LENGTH <- 5.5 DEFAULT_GOAL_AREA_WIDTH <- 18.32 DEFAULT_GOAL_DEPTH <- 2.44 # DEFAULT_CORNER_ARC_R <- 1.0 half_p_l <- DEFAULT_PITCH_LENGTH/2 half_p_w <- DEFAULT_PITCH_WIDTH/2 penalty_x <- half_p_l - DEFAULT_PENALTY_AREA_LENGTH penalty_y <- DEFAULT_PENALTY_AREA_WIDTH/2 goal_x <- half_p_l - DEFAULT_GOAL_AREA_LENGTH goal_y <- DEFAULT_GOAL_AREA_WIDTH/2 make_field <- function(input_graph){ p <- input_graph + geom_hline(yintercept = 0, linetype = "solid")+ geom_vline(xintercept = 0, linetype = "solid")+ geom_linerange(aes(x=half_p_l, y=NULL, ymin=-half_p_w, ymax=half_p_w))+ geom_linerange(aes(x=-half_p_l, y=NULL, ymin=-half_p_w, ymax=half_p_w))+ geom_linerange(aes(x=NULL, y=half_p_w, xmin=-half_p_l, xmax=half_p_l))+ geom_linerange(aes(x=NULL, y=-half_p_w, xmin=-half_p_l, xmax=half_p_l))+ geom_point(size=0.1) + geom_linerange(aes(x=penalty_x, y=NULL, ymin=-penalty_y, ymax=penalty_y))+ geom_linerange(aes(x=-penalty_x, y=NULL, ymin=-penalty_y, ymax=penalty_y))+ geom_linerange(aes(x=NULL, y=penalty_y, xmin=penalty_x, xmax=half_p_l))+ geom_linerange(aes(x=NULL, y=-penalty_y, xmin=penalty_x, xmax=half_p_l))+ geom_linerange(aes(x=NULL, y=penalty_y, xmax=-penalty_x, xmin=-half_p_l))+ geom_linerange(aes(x=NULL, y=-penalty_y, xmax=-penalty_x, xmin=-half_p_l))+ geom_linerange(aes(x=goal_x, y=NULL, ymin=-goal_y, ymax=goal_y))+ geom_linerange(aes(x=-goal_x, y=NULL, ymin=-goal_y, ymax=goal_y))+ geom_linerange(aes(x=NULL, y=goal_y, xmax=goal_x, xmin=half_p_l))+ geom_linerange(aes(x=NULL, y=-goal_y, xmax=goal_x, xmin=half_p_l))+ geom_linerange(aes(x=NULL, y=goal_y, xmin=-goal_x, xmax=-half_p_l))+ geom_linerange(aes(x=NULL, y=-goal_y, xmin=-goal_x, xmax=-half_p_l))+ ggforce::geom_circle(aes(x0 = 0, y0 = 0, r = DEFAULT_CENTER_CIRCLE_R),inherit.aes = FALSE) return(p) } make_heatmap <- function(p_data){ p <- ggplot(data = p_data, aes(x = as.numeric(x), y = as.numeric(y))) + ggplot2::coord_fixed(xlim=c(-half_p_l,half_p_l),ylim =c(-half_p_w,half_p_w))+ geom_density_2d_filled(alpha = 0.5) p <- p |> make_field() return(p) } # make_kick_point <- function(p_data,input_graph){ # log_data <- p_data # p <- input_graph + # geom_point(data = p_data,aes(x = as.numeric(x), y = as.numeric(y))) # return(p) # }