SI.cgi {RGeostats} | R Documentation |
Calculate the Center of Gravity and the Inertia
SI.cgi(db, name = db.getname(db,"z",1), flag.plot=TRUE, flag.inertia=FALSE, flag.ellipse=FALSE, col="black", density=0, ...)
db |
Name of the |
name |
Name of the variable used for calculating the gravity center and the inertia. If not defined, the sample coordinates are used only |
flag.plot |
When TRUE, the gravity center and the inertia are represented graphically |
flag.inertia |
When TRUE, the inertia axes are represented. They correspond to the standard deviation of the projection of the population along these axes. Only valid if flag.plot is TRUE and if Db is defined in 2-D. |
flag.ellipse |
When TRUE, the inertia ellipse (not its surface) represents the population. This ellipse has the same gravity center, the same inertia and the same anisotropie as the initial population. Only valid if flag.plot is TRUE and if Db is defined in 2-D. |
col |
Color used for representing the gravity center and the inertia (used when flag.plot=TRUE) |
density |
Density of the shading lines (see polygon) |
... |
Additional parameters passed to the function |
The Center of Gravity and Inertia are calculated from the data location. If the argument 'name' is specified, the calculations take it into account. Finally a weight can be attached to each datum (if a variable is assigned to the locator "w").
A list which contains the following information:
* inertia : Value of the inertia
* weight : Total weight
* iso : isotropy index
* center : Coordinates of the center of gravity
* mvalue : Vector of Eigen values
* mvector : Matrix of the Eigen vectors
* axes : Inertia axes
# Load data rg.load(filename="Demo.hake.bob.db.data",objname="db.data") rg.load(filename="Demo.hake.bob.poly.data",objname="poly.data") projec.define(projection="mean",db=db.data) # The next lines produce a display of Coast Line and Samples plot(db.data,title="Center of gravity and inertia", asp=1,xlim=c(-300,150),ylim=c(-200,150),inches=5) plot(poly.data,col=8,add=TRUE) # The next line calculate end display the inertia si = SI.cgi(db.data,flag.plot=TRUE,flag.inertia=TRUE,col=2) res = projec.invert(si$center[1],si$center[2]) cat("Gravity center =",res$x,res$y,"\n") # Plot the center of gravity, the inertia and the isotropy of the samples plot(db.add(db.data,S=1),add=TRUE,col=1,inches=5,pch="+") SI.cgi(db.add(db.data,S=A0>=0),flag.plot=TRUE,flag.inertia=TRUE,col=1) rm(db.data,poly.data,res,si)