Learn R Programming

spt (version 1.1-1)

spt: Sierpinski Pedal Triangle and Sierpinski Triangle

Description

To draw Sierpinski pedal triangles (SPTs) and Sierpinski triangles (PTs).

Usage

spt(A,B,x0,y0,iter,plot=TRUE, spt=TRUE,chaosgame=FALSE,main=NULL,tol=0.0001,...)

Arguments

A,B
The degrees of two of the three angles of a triangle.
x0,y0
The initial position of the point if "chaosgame=TRUE".
iter
Iteration number in drawing the SPTs/PTs.
plot
Draw the SPT/PT (default) or compute the SPT dimention alone.
spt
SPT ("spt=TRUE") or PT ("spt=FALSE").
chaosgame
To draw the SPTs/PTs using regular method or via a chaos game.
main
Specify the title of the plot.
tol
A stopping creiteria to draw the sub-SPT/PT. Default value 0.0001.
...
control

Value

  • The dimension of the SPT will be returned if the original triangle is an acute triangle.

Details

When the original triangle is an acute triangle, the area of the smallest SPT/PT to be drawn is determined by (tol * S), where S is the total area for plotting. No restriction is applied to iter.

If the original triangle is an obtuse triangle and spt=TRUE, the largest value of iter is 12.

If the SPTs/PTs are drawn via a chaos game, iter=10000 by default.

References

Zhang, XM., Hitt, R. Wang, B. and Ding, J. (2008). Sierpinski Pedal Triangle. Fractals. 16(2): 141-150.

Examples

Run this code
spt(45,55,spt=FALSE)
 spt(45,55,spt=TRUE)
 spt(120,30,iter=3)
 spt(20,20,iter=7)

Run the code above in your browser using DataLab