R/Visualizer4Point.R

Defines functions Visualizer4Point

#' @title Visualizing points for games with 4 players
#' @description Draws a point for games with 4 players
#' @aliases Visualizer4Point
#' @param  A contains a game vector
#' @param  pointsToDraw contains the points to draw
#' @param  colour draws the polyhedron with this colour
#' @param  label activates the label for the figur
#' @param  name set a name for the label
#' @template author/FM
#' @template author/JS
#' @noRd
 
Visualizer4Point <- function(A, pointsToDraw, colour = NA , label=TRUE, name = NULL){ 
  if (requireNamespace("rgl", quietly = TRUE)) {
    if(is.na(colour)){
      colour="black"
    }
    #Vertices for imputationset
    X=rbind(c(0, 0, 0),  
            c(1, 0, 0),
            c(0.5, 0.5 * sqrt(3), 0),
            c(0.5, 1/6 * sqrt(3), 1/3 *sqrt(6)))
    
    vertices = bary2cart(X,pointsToDraw/A[15])
    
    #Drawing the points
    rgl::points3d(vertices[1],vertices[2],vertices[3],col=colour,size=10.0)
    
    #Label
    if(label == TRUE)
    {
      setLabels(A, pointsToDraw, name)
    }
  } else
  { print("Please install the package 'rgl' in order to generate plots visualizing 4-player TU games")}
}

Try the CoopGame package in your browser

Any scripts or data that you put into this service are public.

CoopGame documentation built on Aug. 24, 2021, 1:07 a.m.