Learn R Programming

geometry (version 0.2-0)

mesh.functions: Special Distance Functions

Description

Elementary distance functions, usefull for defining distance functions of more complex regions.

Usage

mesh.dcircle(p, radius = 1, ...)
mesh.dsphere(p, radius = 1, ...)mesh.drectangle(p, x1 = -1/2, y1 = -1/2, x2 = 1/2, y2 = 1/2, ...)mesh.diff(p, regionA, regionB, ...)mesh.intersect(p, regionA, regionB, ...)mesh.union(p, regionA, regionB, ...)

Arguments

p
A matrix with 2 columns (3 in mesh.dsphere), each row representing a point in the plane.
radius
radius of circle
x1
lower left corner of rectangle
y1
lower left corner of rectangle
x2
upper right corner of rectangle
y2
upper right corner of rectangle
regionA
vectorized function describing region A in the union / intersection / difference
regionB
vectorized function describing region B in the union / intersection / difference
...
additional arguments passed to regionA and regionB

Value

  • a vector of length nrow(p) containing the signed distances

Details

regionA and regionB must accept a matrix p with 2 columns as their first argument, and must return a vector of length nrow(p) containing the signed distances of the supplied points in p to their respective regions.

References

http://www-math.mit.edu/~persson/mesh/ P.-O. Persson, G. Strang, A Simple Mesh Generator in MATLAB. SIAM Review, Volume 46 (2), pp. 329-345, June 2004

See Also

distmesh2d

Examples

Run this code
example(distmesh2d)

Run the code above in your browser using DataLab