Skip to content

Commit 5034f51

Browse files
committed
Documentation details
1 parent 6450013 commit 5034f51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+476
-131
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ S3method(flinn,ellipsoid)
4242
S3method(flinn,ortensor)
4343
S3method(flinn_plot,default)
4444
S3method(flinn_plot,ellipsoid)
45+
S3method(flinn_plot,list)
4546
S3method(flinn_plot,ortensor)
4647
S3method(flinn_plot,spherical)
4748
S3method(geodesic_mean,Line)

R/best_pole.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ regression_greatcircle <- function(x, val = seq_len(nrow(x)), iterations = 1000L
457457
}
458458

459459
rot_vec <- as.Vec3(rot[, 3])
460-
460+
461461
result <- list(
462462
vec = Spherical(rot_vec, class(x)[1]),
463463
range = a,
@@ -478,7 +478,7 @@ regression_greatcircle <- function(x, val = seq_len(nrow(x)), iterations = 1000L
478478
result$points <- lapply(
479479
seq(from = min(val), to = max(val), length.out = (n_points + 1)),
480480
result$prediction
481-
) |>
481+
) |>
482482
list_vec()
483483
}
484484

R/confidence.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,3 @@ confidence_ellipse <- function(x, n_iter = 10000L, alpha = 0.05, res = 512L, iso
7979
ellipse = ellipse
8080
)
8181
}
82-

R/data.R

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
"ramsay"
167167

168168

169-
#' 3D Strain Data
169+
#' 3D Strain Data I
170170
#'
171171
#' Example data from Holst and Fossen (1987) containing 3D strain data from 17 localities in the West Norwegian Caledonides.
172172
#' The data gives the difference of the \eqn{\epsilon_1} and \eqn{\epsilon_2} (`e1e2`) and \eqn{\epsilon_2} and \eqn{\epsilon_3} (`e2e3`)
@@ -183,6 +183,25 @@
183183
"holst"
184184

185185

186+
#' 3D Strain Data II
187+
#'
188+
#' Example data from J.R. Hossack (1968) containing 3D strain data from 81
189+
#' localities from the Bygdin Conglomerate by the Upper Jotun Nappe. The data
190+
#' gives the mean axial ratios (X, Y, Z) of the deformed pebbles.
191+
#' Different to Hossack, here X is the longest axes, and Z the shortest.
192+
#'
193+
#' @docType data
194+
#'
195+
#' @usage data('hossack1968')
196+
#'
197+
#' @format An object of class `matrix`
198+
#' @family datasets
199+
#' @keywords datasets
200+
#' @examples
201+
#' data("hossack1968")
202+
#' head(hossack1968)
203+
"hossack1968"
204+
186205
#' Vorticity from Rotated Porphyroclasts
187206
#'
188207
#' 194 measurements of aspect ratio and orientation (wrt. foliation) of rotated

R/deftensor.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#'
3333
#' \item{`defgrad_from_vectors()` creates `"defgrad"` tensor representing rotation around the
3434
#' axis perpendicular to both vectors and rotate `v1` to `v2`.}
35-
#'
35+
#'
3636
#' \item{`defgrad_from_axisangle` creates `"defgrad"` tensor representing a rigid-body
3737
#' rotation about an axis and an angle.}
3838
#'

R/density.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ density_calc <- function(x,
335335
weights = NULL, upper.hem = FALSE, r = 1) {
336336
x_grid <- y_grid <- seq(-1, 1, length.out = n)
337337

338-
grid <- expand.grid(x_grid, y_grid) |>
338+
grid <- expand.grid(x_grid, y_grid) |>
339339
as.matrix()
340340
dg <- density_grid(x, weights = weights, upper.hem = upper.hem, kamb = TRUE, FUN = FUN, sigma = sigma, ngrid = n, r = r)
341341
density_matrix <- matrix(dg$density, nrow = n, byrow = FALSE)

R/ellipsoid.R

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
#' @family ellipsoid
1414
#' @seealso [ortensor()]
1515
#'
16+
#' @details
17+
#' The eigenvalues \eqn{\lambda} of the deformation matrix are the quadratic
18+
#' forms of the principal stretches \eqn{s} (\eqn{s = 1 + \epsilon = l/l_0}).
19+
#'
1620
#' @returns
1721
#' `is.ellipsoid` returns `TRUE` if `x` is an `"ellipsoid"` object, and `FALSE` otherwise.
1822
#'
@@ -78,9 +82,19 @@ print.ellipsoid <- function(x, ...) {
7882
#' @returns object of class `"ellipsoid"`
7983
#' @export
8084
#'
85+
#' @details
86+
#' The eigenvalues \eqn{\lambda} of the deformation matrix are the quadratic
87+
#' forms of the principal stretches \eqn{s} (\eqn{s = 1 + \epsilon = l/l_0}).
88+
#'
89+
#' @family ellipsoid
90+
#'
8191
#' @examples
8292
#' el <- ellipsoid_from_stretch(4, 3, 1)
8393
#' principal_stretch(el)
94+
#'
95+
#' lapply(seq.int(nrow(hossack1968)), function(i) {
96+
#' ellipsoid_from_stretch(hossack1968[i, 3], hossack1968[i, 2], hossack1968[i, 1])
97+
#' })
8498
ellipsoid_from_stretch <- function(x = 1, y = 1, z = 1) {
8599
el <- matrix(c(
86100
x^2, 0, 0,
@@ -97,31 +111,35 @@ ellipsoid_from_stretch <- function(x = 1, y = 1, z = 1) {
97111
#' lengths (in any order), an object of class `"ellipsoid"`, or an object of class `"ortensor"`.
98112
#'
99113
#' @returns positive numeric
114+
#' @family ellipsoid
100115
#' @name ellipsoid-params
101116
#'
102-
#' @details
103-
#'
104-
#' \deqn{e_i = \log s_i} with \eqn{s1 \geq s2 \geq s3} the semi-axis lengths of the ellipsoid.
117+
#' @details The natural strain is
118+
#' \deqn{\bar{\epsilon}_i = \log s_i = \log(1 + \epsilon_i)} with \eqn{s_1 \geq s_2 \geq s_3} the semi-axis lengths of the ellipsoid, or
119+
#' \eqn{\epsilon_i} the strains (elongation) given by \eqn{\epsilon = \frac{l-l_0}{l_0}} (hence \eqn{s = \frac{l}{l_0}}).
105120
#'
106-
#' Lode's shape parameter:
107-
#' \deqn{\nu = \frac{2 e_2 - e_1 - e_3}{e_1-e_3}}
108-
#' with \eqn{e_1 \geq e_2 \geq e_3}. Note that \eqn{\nu} is undefined for spheres,
109-
#' but we arbitrarily declare \eqn{\nu=0} for them.
110-
#' Otherwise \eqn{-1 \geq \nu \geq 1}. \eqn{\nu=-1} for prolate spheroids and \eqn{\nu=1} for oblate spheroids.
121+
#' Lode's parameter for **strain symmetry**:
122+
#' \deqn{\nu = \frac{2 \bar{\epsilon}_2 - \bar{\epsilon}_1 - \bar{\epsilon}_3}{\bar{\epsilon}_1-\bar{\epsilon}_3}}
123+
#' with \eqn{\bar{\epsilon}_1 \geq \bar{\epsilon}_2 \geq \bar{\epsilon}_3}. Note that \eqn{\nu} is undefined for spheres,
124+
#' but we arbitrarily declare \eqn{\nu=0} for them (plane strain).
125+
#' Otherwise \eqn{-1 \geq \nu \geq 1}. \eqn{\nu=-1} for prolate spheroids (constriction) and \eqn{\nu=1} for oblate spheroids (flattening).
111126
#'
112-
#' Octahedral shear strain \eqn{e_s} (Nadai 1963):
113-
#' \deqn{e_s = \sqrt{\frac{(e_1 - e_2)^2 + (e_2 - e_3)^2 + (e_1 - e_3)^2 }{3}}}
127+
#' **Octahedral shear strain** \eqn{\bar{\epsilon}_s} (Nádai 1963):
128+
#' \deqn{\bar{\epsilon}_s = \sqrt{\frac{(\bar{\epsilon}_1 - \bar{\epsilon}_2)^2 + (\bar{\epsilon}_2 - \bar{\epsilon}_3)^2 + (\bar{\epsilon}_1 - \bar{\epsilon}_3)^2 }{3}}}
129+
#' This is the amount of strain assuming coaxial deformation (pure-shear).
114130
#'
115-
#' Strain symmetry (Flinn 1963):
131+
#' **Strain symmetry** (Flinn 1963):
116132
#' \deqn{k = \frac{s_1/s_2 - 1}{s_2/s_3 - 1}}
133+
#' The value ranges from 0 to \eqn{\infty}, and is 0 for oblate ellipsoids
134+
#' (flattening), 1 for plane strain and \eqn{\infty} for prolate ellipsoids (constriction).
117135
#'
118-
#' and strain intensity (Flinn 1963):
136+
#' and **strain intensity** (Flinn 1963):
119137
#' \deqn{d = \sqrt{(s_1/s_2 - 1)^2 + (s_2/s_3 - 1)^2}}
120-
#'
138+
#' This is analogous to Nadai's strain parameter.
121139
#'
122140
#' Jelinek (1981)'s \eqn{P_j} parameter:
123-
#' \deqn{P_j = e^{\sqrt{2 \vec{v}\cdot \vec{v}}}}
124-
#' with \eqn{\vec{v} = e_i - \frac{\sum e_i}{3}}
141+
#' \deqn{P_j = \bar{\epsilon}^{\sqrt{2 \vec{v}\cdot \vec{v}}}}
142+
#' with \eqn{\vec{v} = \bar{\epsilon}_i - \frac{\sum \bar{\epsilon}_i}{3}}
125143
#'
126144
#' @references
127145
#' Flinn, Derek.(1963): "On the statistical analysis of fabric diagrams."
@@ -133,15 +151,15 @@ ellipsoid_from_stretch <- function(x = 1, y = 1, z = 1) {
133151
#' the metals iron, copper and nickel"*], Zeitschrift für Physik, vol. 36 (November),
134152
#' pp. 913–939, \doi{10.1007/BF01400222}
135153
#'
136-
#' Nadai, A., and Hodge, P. G., Jr. (1963): "Theory of Flow and Fracture of Solids,
154+
#' Nádai, A., and Hodge, P. G., Jr. (1963): "Theory of Flow and Fracture of Solids,
137155
#' vol. II." ASME. J. Appl. Mech. December 1963; 30(4): 640. \doi{10.1115/1.3636654}
138156
#'
139157
#' Jelinek, Vit. "Characterization of the magnetic fabric of rocks."
140158
#' Tectonophysics 79.3-4 (1981): T63-T67.
141159
#'
142-
#' @seealso [shape_params()], [ot_eigen()]
160+
#' @seealso [shape_params()], [ot_eigen()], [hsu_plot()], [flinn_plot()]
143161
#' @examples
144-
#' # Generate some random data
162+
#' # Generate some random orientation data
145163
#' set.seed(20250411)
146164
#' dat <- rvmf(100, k = 20)
147165
#' s <- principal_stretch(dat)
@@ -158,7 +176,7 @@ ellipsoid_from_stretch <- function(x = 1, y = 1, z = 1) {
158176
#' # Shape-related tensor invariant of ellipsoids
159177
#' shape_invariant(s)
160178
#'
161-
#' # Lode's shape parameter
179+
#' # Lode's shape parameter for the strain symmetry ratio
162180
#' lode(s)
163181
#'
164182
#' # Nadai's octahedral shear strain
@@ -171,6 +189,12 @@ ellipsoid_from_stretch <- function(x = 1, y = 1, z = 1) {
171189
#' flinn(s)
172190
#'
173191
#' kind(s)
192+
#'
193+
#' # Ellipsoid data
194+
#' hossack_ell <- lapply(seq.int(nrow(hossack1968)), function(i) {
195+
#' ellipsoid_from_stretch(hossack1968[i, 3], hossack1968[i, 2], hossack1968[i, 1])
196+
#' })
197+
#' sapply(hossack_ell, nadai)
174198
NULL
175199

176200

R/fabric_plots.R

Lines changed: 79 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Fabric intensities and plots -------------------------------------------------
22

3-
#' Orientation tensor fabric intensity and shape
3+
#' Fabric Intensity and Shape of Orientation Tensor
44
#'
55
#' Fabric intensity and shape parameters of the orientation tensor based on Vollmer (1990)
66
#'
@@ -66,7 +66,7 @@ vollmer <- function(x) {
6666
c(P = P, G = G, R = R, B = B, C = C, I = I, D = D, U = U)
6767
}
6868

69-
#' Fabric plot of Vollmer (1990)
69+
#' Fabric Plot of Vollmer (1990)
7070
#'
7171
#' Creates a fabric plot using the eigenvalue method
7272
#'
@@ -219,7 +219,7 @@ vollmer_plot.list <- function(x, labels = NULL, add = FALSE, ngrid = c(5, 5, 5),
219219
}
220220

221221

222-
#' Fabric plot of Woodcock (1977)
222+
#' Fabric Plot of Woodcock (1977)
223223
#'
224224
#' Creates a fabric plot using the eigenvalue method
225225
#'
@@ -294,23 +294,48 @@ woodcock_plot <- function(x, labels = NULL, add = FALSE, max = 7, main = "Woodco
294294
invisible(x_eigen)
295295
}
296296

297-
#' Fabric plot of Hsu (1965)
297+
#' Fabric Plot of Hsu (1965)
298298
#'
299-
#' 3D strain diagram using the Hsu (1965) method to display the natural
300-
#' octahedral strain (Nádai, 1950) and Lode's parameter (Lode, 1926).
299+
#' 3D strain diagram using the Hsu (1965) method to display the amount of the natural
300+
#' octahedral strain, \eqn{\bar{\epsilon}_s} (Nádai, 1950) and Lode's parameter
301+
#' for the symmetry of strain \eqn{\nu} (Lode, 1926).
301302
#'
302-
#' @param x accepts the following objects: a two-column matrix where first column is the ratio of maximum strain and
303-
#' intermediate strain (X/Y) and second column is the the ratio of intermediate strain and minimum strain (Y/Z);
304-
#' objects of class `"Vec3"`, `"Line"`, `"Ray"`, or `"Plane"`; or `"ortensor"` objects.
303+
#' @param x accepts the following objects: a two-column matrix where first
304+
#' column is the ratio of maximum strain and
305+
#' intermediate strain (X/Y) and second column is the the ratio of intermediate
306+
#' strain and minimum strain (Y/Z);
307+
#' objects of class `"Vec3"`, `"Line"`, `"Ray"`, `"Plane"`, `"ortensor"` and `"ellipsoid"` objects.
308+
#' Tensor objects can also be lists of such objects (`"ortensor"` and `"ellipsoid"`).
305309
#' @inheritParams Rphi_plot
306310
#' @param labels character. text labels
307311
#' @param add logical. Should data be plotted to an existing plot?
308312
#' @param ... plotting arguments passed to [graphics::points()]
309313
#' @param es.max maximum strain for scaling.
310314
#'
311-
#' @returns plot and when stored as object, a list containing the Lode parameter `lode` and the natural octahedral strain `es`.
315+
#' @returns a list containing the Lode parameter `lode` and the natural octahedral strain `es`.
312316
#' @family fabric-plot
313317
#' @seealso [lode()] for Lode parameter, and [nadai] for natural octahedral strain.
318+
#' [ellipsoid()] class, [ortensor()] class
319+
#'
320+
#' @details
321+
#' The **amount of strain** related to the natural octahedral unit shear \eqn{\bar{\gamma}_o}
322+
#' is (Nádai, 1963, p.73):
323+
#' \deqn{\bar{\epsilon}_s = \frac{\sqrt{3}}{2} \bar{\gamma}_o}
324+
#' where \eqn{\bar{\gamma}_o} is defined as
325+
#' \deqn{\bar{\gamma}_o = \frac{2}{3} \sqrt{(\bar{\epsilon}_1 - \bar{\epsilon}_2)^2 + (\bar{\epsilon}_2 - \bar{\epsilon}_3)^2 + (\bar{\epsilon}_3 - \bar{\epsilon}_1)^2}}
326+
#' and \eqn{\bar{\epsilon}} is the natural strain (\eqn{\bar{\epsilon} = \log{1+\epsilon}})
327+
#' and \eqn{\epsilon} is the conventional strain given by \eqn{\epsilon = \frac{l-l_0}{l_0}}
328+
#' where \eqn{l} and \eqn{l_0} is the length after and before the strain, respectively (Nádai, 1959, p.70).
329+
#' The amount of strain \eqn{\bar{\epsilon}_s} is directly proportional to the
330+
#' amount of mechanical work applied in the coaxial component of strain.
331+
#'
332+
#' The **symmetry of strain** is defined by Lode’s (1926, p.932) ratio (\eqn{\nu}):
333+
#' \deqn{\nu = \frac{2 \bar{\epsilon}_2 - \bar{\epsilon}_1 - \bar{\epsilon}_3}{\bar{\epsilon}_1 - \bar{\epsilon}_3}}
334+
#' The values range between -1 and +1, where -1 gives constriction, 0 gives
335+
#' plane strain, and +1 gives flattening.
336+
#'
337+
#' @note Hossack (1968) was the first one to use this graphical representation
338+
#' of 3D strain and called the plot "Strain plane plot"
314339
#'
315340
#' @name hsu_plot
316341
#'
@@ -328,10 +353,12 @@ woodcock_plot <- function(x, labels = NULL, add = FALSE, max = 7, main = "Woodco
328353
#' (Southern Norway). Tectonophysics, 5(4), 315–339. \doi{10.1016/0040-1951(68)90035-8}
329354
#'
330355
#' @examples
356+
#' # default
331357
#' R_XY <- holst[, "R_XY"]
332358
#' R_YZ <- holst[, "R_YZ"]
333359
#' hsu_plot(cbind(R_XY, R_YZ), col = "#B63679", pch = 16, type = "b")
334360
#'
361+
#' # orientation data
335362
#' set.seed(20250411)
336363
#' mu <- Line(120, 50)
337364
#' x <- rvmf(100, mu = mu, k = 1)
@@ -340,6 +367,12 @@ woodcock_plot <- function(x, labels = NULL, add = FALSE, max = 7, main = "Woodco
340367
#' set.seed(20250411)
341368
#' y <- rvmf(100, mu = mu, k = 20)
342369
#' hsu_plot(ortensor(y), labels = "y", col = "red", add = TRUE)
370+
#'
371+
#' # ellipsoid objects
372+
#' hossack_ell <- lapply(seq.int(nrow(hossack1968)), function(i) {
373+
#' ellipsoid_from_stretch(hossack1968[i, 3], hossack1968[i, 2], hossack1968[i, 1])
374+
#' })
375+
#' hsu_plot(hossack_ell, col = "#B63679", pch = 16)
343376
NULL
344377

345378
#' @rdname hsu_plot
@@ -532,16 +565,31 @@ hsu_plot.list <- function(x, labels = NULL, add = FALSE, es.max = 3, main = "Hsu
532565
}
533566

534567

535-
#' Flinn diagram
568+
#' Flinn Diagram
569+
#'
570+
#' Plots the strain ratios X/Y against Y/Z and shows the strain intensity and
571+
#' the strain symmetry after Flinn (1965)
536572
#'
537573
#' @inheritParams hsu_plot
538574
#' @param R.max numeric. Maximum aspect ratio for scaling.
539575
#' @param log logical. Whether the axes should be in logarithmic scale.
540576
#'
541-
#' @returns plot and when stored as an object, the multiplication factors for X, Y and Z.
577+
#' @returns list. Relative magnitudes of X, Y and Z (Z=1).
542578
#'
543579
#' @family fabric-plot
544580
#' @name flinn_plot
581+
#' @seealso [ellipsoid()] class, [ortensor()] class, [flinn()] for Flinn's
582+
#' strain parameters.
583+
#'
584+
#' @details **Strain symmetry** (Flinn 1965):
585+
#' \deqn{k = \frac{s_1/s_2 - 1}{s_2/s_3 - 1}}
586+
#' where \eqn{s_1 \geq s_2 \geq s_3} the semi-axis lengths of the ellipsoid.
587+
#' The value ranges from 0 to \eqn{\infty}, and is 0 for oblate ellipsoids
588+
#' (flattening), 1 for plane strain and \eqn{\infty} for prolate ellipsoids (constriction).
589+
#'
590+
#' and **strain intensity** (Flinn 1965):
591+
#' \deqn{d = \sqrt{(s_1/s_2 - 1)^2 + (s_2/s_3 - 1)^2}}
592+
#'
545593
#'
546594
#' @references Flinn, D. (1965). On the Symmetry Principle and the Deformation
547595
#' Ellipsoid. Geological Magazine, 102(1), 36–45. \doi{10.1017/S0016756800053851}
@@ -553,6 +601,12 @@ hsu_plot.list <- function(x, labels = NULL, add = FALSE, es.max = 3, main = "Hsu
553601
#' flinn_plot(cbind(R_XY, R_YZ), log = FALSE, col = "#B63679", pch = 16)
554602
#' flinn_plot(cbind(R_XY, R_YZ), log = TRUE, col = "#B63679", pch = 16, type = "b")
555603
#'
604+
#' # ellipsoid objects
605+
#' hossack_ell <- lapply(seq.int(nrow(hossack1968)), function(i) {
606+
#' ellipsoid_from_stretch(hossack1968[i, 3], hossack1968[i, 2], hossack1968[i, 1])
607+
#' })
608+
#' flinn_plot(hossack_ell, col = "#B63679", pch = 16, log = TRUE)
609+
#'
556610
#' set.seed(20250411)
557611
#' mu <- Line(120, 50)
558612
#' x <- rvmf(100, mu = mu, k = 1)
@@ -669,3 +723,16 @@ flinn_plot.ellipsoid <- function(x, ...) {
669723
flinn_plot.spherical <- function(x, ...) {
670724
flinn_plot.ortensor(ortensor(x), ...)
671725
}
726+
727+
#' @rdname flinn_plot
728+
#' @export
729+
flinn_plot.list <- function(x, ...) {
730+
a <- lapply(x, principal_stretch) |>
731+
sapply(sort, decreasing = TRUE) |>
732+
t()
733+
734+
R_xy <- a[, 1] / a[, 2]
735+
R_yz <- a[, 2] / a[, 3]
736+
737+
flinn_plot.default(cbind(R_xy, R_yz), ...)
738+
}

R/geodesic_mean.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,4 +552,3 @@ symmetry_group <- function(group = c("triclinic", "ray_in_plane", "line_in_plane
552552
)
553553
}
554554
}
555-

0 commit comments

Comments
 (0)