Skip to content

Commit

Permalink
equation aspect ratio cyclide
Browse files Browse the repository at this point in the history
  • Loading branch information
stla committed May 16, 2024
1 parent 3007402 commit 450e19c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/aaa.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ NULL
CGALmesh <- setRcppClass("CGALmesh")

CGALversion <- function() {
5.5
5.6
}
10 changes: 10 additions & 0 deletions R/cgalMesh.R
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
Expand Down
7 changes: 6 additions & 1 deletion R/someMeshes.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 450e19c

Please sign in to comment.