library(knitr)
library(rgl)
opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-",
  echo = TRUE, warning=FALSE, message=FALSE, include = TRUE, fig.show='hold'
)
knit_hooks$set(webgl = hook_webgl, rgl = hook_rgl)
library(gMOIP)

An interactive 3D plot

A <- matrix( c(
   3, 2, 5,
   2, 1, 1,
   1, 1, 3,
   5, 2, 4
), nc = 3, byrow = TRUE)
b <- c(55, 26, 30, 57)
obj <- c(20, 10, 15)

Rotate/zoom/twist the plot with your mouse:

# LP model
view <- matrix( c(-0.412063330411911, -0.228006735444069, 0.882166087627411, 0, 0.910147845745087,
                  -0.0574885793030262, 0.410274744033813, 0, -0.042830865830183, 0.97196090221405,
                  0.231208890676498, 0, 0, 0, 0, 1), nc = 4)   
loadView(v = view)  # set view angle
plotPolytope(A, b, plotOptimum = TRUE, obj = obj, labels = "coord")


relund/gMOIP documentation built on Feb. 23, 2024, 12:11 p.m.