diff --git a/R/aaa.R b/R/aaa.R index 321ac06..3a72e7b 100644 --- a/R/aaa.R +++ b/R/aaa.R @@ -6,5 +6,5 @@ NULL CGALmesh <- setRcppClass("CGALmesh") CGALversion <- function() { - 5.5 + 5.6 } \ No newline at end of file diff --git a/R/cgalMesh.R b/R/cgalMesh.R index c364571..e458fa4 100644 --- a/R/cgalMesh.R +++ b/R/cgalMesh.R @@ -1628,6 +1628,16 @@ cgalMesh <- R6Class( invisible(self) }, + #' @description Triangulate mesh. + #' @return The modified \code{cgalMesh} object, invisibly. \strong{WARNING}: + #' even if you store the result in a new variable, the original mesh is + #' modified (see the example). You may want to triangulate a copy of the + #' mesh; see the \code{copy} method. + "triangulate2" = function() { + private[[".CGALmesh"]]$triangulate2() + invisible(self) + }, + #' @description Union with another mesh. Both meshes must be triangle. Face #' properties of the two united meshes are copied to the union mesh. #' \strong{WARNING}: this modifies the reference mesh and \code{mesh2}. diff --git a/R/someMeshes.R b/R/someMeshes.R index a1bafad..961e395 100644 --- a/R/someMeshes.R +++ b/R/someMeshes.R @@ -293,7 +293,7 @@ cyclideMesh <- function(a, c, mu, nu = 90L, nv = 40L){ nv <- as.integer(nv) vertices <- matrix(NA_real_, nrow = 3L, ncol = nu*nv) normals <- matrix(NA_real_, nrow = nu*nv, ncol = 3L) - b2 <- a * a - c * c; + b2 <- a * a - c * c bb <- sqrt(b2 * (mu * mu - c * c)) omega <- (a * mu + bb) / c Omega0 <- c(omega, 0, 0) @@ -305,6 +305,11 @@ cyclideMesh <- function(a, c, mu, nu = 90L, nv = 40L){ h <- (c * c) / ((a - c) * (mu - c) + bb) r <- (h * (mu - c)) / ((a + c) * (mu - c) + bb) R <- (h * (a - c)) / ((a - c) * (mu + c) + bb) + # a' = a/c; mu' = mu/c + # R/r = (a'-1)/(mu'-1) * ((a'+1)*(mu'-1) + sqrt((a'^2-1)*(mu'^2-1))) / ((a'-1)*(mu'+1)+sqrt((a'^2-1)*(mu'^2-1))) + # = (a'-1)/(mu'-1) * ((a'+1)*(mu'-1)/(a'-1) + sqrt((mu'^2-1)*(a'+1)/(a'-1))) / ((mu'+1) + sqrt((mu'^2-1)*(a'+1)/(a'-1))) + # = ((aa+1) * (1 + sqrt((aa-1)/(aa+1))*sqrt((muu+1)/(muu-1))) / ((muu+1) * (1 + sqrt((aa+1)/(aa-1))*sqrt((muu-1)/(muu+1))))) + #(Wolfram) muu = sqrt(1 + (aa^2-1)/ratio^2) bb2 <- b2 * (mu * mu - c * c) denb1 <- c * (a*c - mu*c + c*c - a*mu - bb) b1 <- (a*mu*(c-mu)*(a+c) - bb2 + c*c + bb*(c*(a-mu+c) - 2*a*mu))/denb1