% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rgl.R
\name{glplot}
\alias{glplot}
\alias{glplot.SpatialPoints}
\alias{glplot.SpatialLines}
\alias{glplot.fm_mesh_2d}
\alias{globe}
\title{Render objects using RGL}
\usage{
glplot(object, ...)

\method{glplot}{SpatialPoints}(object, add = TRUE, color = "red", ...)

\method{glplot}{SpatialLines}(object, add = TRUE, ...)

\method{glplot}{fm_mesh_2d}(object, add = TRUE, col = NULL, ...)

globe(
  R = 1,
  R.grid = 1.05,
  specular = "black",
  axes = FALSE,
  box = FALSE,
  xlab = "",
  ylab = "",
  zlab = ""
)
}
\arguments{
\item{object}{an object used to select a method.}

\item{\dots}{Parameters passed on to \code{plot_rgl.fm_mesh_2d()}}

\item{add}{If TRUE, add the points to an existing plot. If FALSE, create new
plot.}

\item{color}{vector of R color characters. See material3d() for details.}

\item{col}{Color specification. A single named color, a vector of scalar
values, or a matrix of RGB values.}

\item{R}{Radius of the globe}

\item{R.grid}{Radius of the annotation sphere.}

\item{specular}{Light color of specular effect.}

\item{axes}{If TRUE, plot x, y and z axes.}

\item{box}{If TRUE, plot a box around the globe.}

\item{xlab, ylab, zlab}{Axes labels}
}
\description{
\code{glplot()} is a generic function for renders various kinds of spatial
objects, i.e. \verb{Spatial*} data and \code{fm_mesh_2d} objects. The function invokes
particular methods which depend on the class of the first argument.
}
\section{Methods (by class)}{
\itemize{
\item \code{glplot(SpatialPoints)}: This function will calculate the cartesian coordinates of
the points provided and use points3d() in order to render them.

\item \code{glplot(SpatialLines)}: This function will calculate a cartesian representation of
the lines provided and use \code{lines3d()} in order to render them.

\item \code{glplot(fm_mesh_2d)}: This function transforms the mesh to 3D cartesian
coordinates and uses \code{\link[fmesher:plot_rgl]{fmesher::plot_rgl()}} to plot the result.

}}
\section{Functions}{
\itemize{
\item \code{globe()}: Visualize a globe using RGL

Creates a textured sphere and lon/lat coordinate annotations.
This function requires the \code{rgl} and \code{sphereplot} packages.

}}
\examples{
\donttest{
if (interactive() &&
  require("rgl", quietly = TRUE) &&
  require("sphereplot", quietly = TRUE) &&
  bru_safe_sp() &&
  require("sp")) {
  # Show the globe:
  globe()

  # Load pantropoical dolphin data
  mexdolphin <- inlabru::mexdolphin_sp()

  # Add mesh, ship transects and dolphin sightings stored
  # as fm_mesh_2d, SpatialLines and SpatialPoints objects, respectively

  glplot(mexdolphin$mesh, alpha = 0.2)
  glplot(mexdolphin$samplers, lwd = 5)
  glplot(mexdolphin$points, size = 10)
}
}

}
