<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Generation of Uniform Points in the Standard Regular...</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="https://rpkg.net/assets/examples.css" />
</head><body>

<table width="100%" summary="page for runif.std.tetra"><tr><td>runif.std.tetra</td><td style="text-align: right;">R Documentation</td></tr></table>

<h2>Generation of Uniform Points
in the Standard Regular Tetrahedron <i>T_h</i></h2>

<h3>Description</h3>

<p>An object of class <code>"Uniform"</code>.
Generates <code>n</code> points uniformly in the standard regular tetrahedron
<i>T_h=T((0,0,0),(1,0,0),(1/2,&radic;{3}/2,0),(1/2,&radic;{3}/6,&radic;{6}/3))</i>.
</p>


<h3>Usage</h3>

<pre>
runif.std.tetra(n)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>n</code></td>
<td>
<p>A positive integer
representing the number of uniform points to be generated in the
standard regular tetrahedron <i>T_h</i>.</p>
</td></tr>
</table>


<h3>Value</h3>

<p>A <code>list</code> with the elements
</p>
<table summary="R valueblock">
<tr valign="top"><td><code>type</code></td>
<td>
<p>The type of the pattern
from which points are to be generated</p>
</td></tr>
<tr valign="top"><td><code>mtitle</code></td>
<td>
<p>The <code>"main"</code> title for the plot of the point pattern</p>
</td></tr>
<tr valign="top"><td><code>tess.points</code></td>
<td>
<p>The vertices of the support region
of the uniformly generated points, it is the
standard regular tetrahedron <i>T_h</i> for this function</p>
</td></tr>
<tr valign="top"><td><code>gen.points</code></td>
<td>
<p>The output set of generated points uniformly
in the standard regular tetrahedron <i>T_h</i>.</p>
</td></tr>
<tr valign="top"><td><code>out.region</code></td>
<td>
<p>The outer region which contains the support region,
<code>NULL</code> for this function.</p>
</td></tr>
<tr valign="top"><td><code>desc.pat</code></td>
<td>
<p>Description of the point pattern
from which points are to be generated</p>
</td></tr>
<tr valign="top"><td><code>num.points</code></td>
<td>
<p>The <code>vector</code> of two numbers,
which are the number of generated points and the number
of vertices of the support points (here it is 4).</p>
</td></tr>
<tr valign="top"><td><code>txt4pnts</code></td>
<td>
<p>Description of the two numbers in <code>num.points</code></p>
</td></tr>
<tr valign="top"><td><code>xlimit,ylimit,zlimit</code></td>
<td>
<p>The ranges of the <i>x</i>-, <i>y</i>-,
and <i>z</i>-coordinates of the support, <i>T_h</i></p>
</td></tr>
</table>


<h3>Author(s)</h3>

<p>Elvan Ceyhan
</p>


<h3>See Also</h3>

<p><code>runif.tetra</code>, <code>runif.tri</code>,
and <code>runif.multi.tri</code>
</p>


<h3>Examples</h3>

<pre>

A&lt;-c(0,0,0); B&lt;-c(1,0,0); C&lt;-c(1/2,sqrt(3)/2,0); D&lt;-c(1/2,sqrt(3)/6,sqrt(6)/3)
tetra&lt;-rbind(A,B,C,D)
n&lt;-100

set.seed(1)
Xdt&lt;-runif.std.tetra(n)
Xdt
summary(Xdt)
plot(Xdt)

Xp&lt;-runif.std.tetra(n)$g

Xlim&lt;-range(tetra[,1])
Ylim&lt;-range(tetra[,2])
Zlim&lt;-range(tetra[,3])
xd&lt;-Xlim[2]-Xlim[1]
yd&lt;-Ylim[2]-Ylim[1]
zd&lt;-Zlim[2]-Zlim[1]

plot3D::scatter3D(Xp[,1],Xp[,2],Xp[,3],
phi =20,theta=15, bty = "g", pch = 20, cex = 1,
ticktype = "detailed",
xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05),
zlim=Zlim+zd*c(-.05,.05))
#add the vertices of the tetrahedron
plot3D::points3D(tetra[,1],tetra[,2],tetra[,3], add=TRUE)
L&lt;-rbind(A,A,A,B,B,C); R&lt;-rbind(B,C,D,C,D,D)
plot3D::segments3D(L[,1], L[,2], L[,3], R[,1], R[,2],R[,3],
add=TRUE,lwd=2)

plot3D::text3D(tetra[,1]+c(.05,0,0,0),tetra[,2],tetra[,3],
labels=c("A","B","C","D"), add=TRUE)

s3d&lt;-scatterplot3d::scatterplot3d(Xp, highlight.3d=TRUE,xlab="x",
ylab="y",zlab="z", col.axis="blue", col.grid="lightblue",
               main="3D Scatterplot of the data", pch=20)
s3d$points3d(tetra,pch=20,col="blue")


</pre>


</body></html>
