primitives

this library contains both standard graphics primitives and  operators for morphing and other computations with 2D shapes, defined as equivalence classes of polylines

  • Displaygraph graph generator for f : IR => IR, where n is a marker index
    Pre/Post conds (n::isint)(f::isfun)(sample::isseqof:isnum) => (ispol)
    Example (displaygraph:1:sin ~ c:al:0 ~ progressivesum ~ #:32):(pi/16)

  • Isclosedshape predicate to test if the arg shape is either closed or not
    Pre/Post conds (arg::isshape) => (isbool)
    Example isclosedshape:< < 5,3,-2.5,-2.5,-3>,< -2,4,-2,2,-2>> == true

  • Iscloseto predicate to test is the arg distance from x is less than 1e-4
    Pre/Post conds (x::isnum)(arg::isnum) => (isbool)
    Example iscloseto:0:0.001 == false; iscloseto:0:1e-6 == true

  • Isorthoshape predicate to test if the arg shape is made by orthogonal segments
    Pre/Post conds (arg::isshape) => (isbool)
    Example isorthoshape:< < 5,3,-2.5,-2.5,-3>,< -2,4,-2,2,-2>> == false

  • Isshape predicate to test if arg is a shape (see Section 7.3)
    Pre/Post conds (arg::and ~ [ispair,ismat]) => (isbool)
    Example isshape:< < 5,3,-2.5,-2.5,-3>,< -2,4,-2,2,-2>> == true

  • Mapshapes returns a sampling of segment between two shapes, made compatible
    Pre/Post conds (p,q::isshape) => (isseqof:isshape)
    Example mapShapes:< < < 5,0,-5>,< 0,5,-5>>,
    < < 0,1,0,-2,0,3,0,-4,0,5>,< -1,0,2,0,-3,0,4,0,-5,0>> >

  • Markersize constant value used to define the marker size. Default value is 0.05
    Pre/Post conds => (isnum)
    Example DEF MarkerSize = 0.10

  • Mesh returns a d-dimensional mesh with hyperparallelepiped cells
    Pre/Post conds (seqs::and ~ aa:(isseqof:isnum)) => (ispol)
    Example (@1 ~ mesh):< < 1,2,1,2,1>,< 1,2,1,2,1,2,1>>

  • Points2shape transforms a 2D point seq into a shape instance
    Pre/Post conds (seq::and ~ [ismat, ispair ~ trans]) => (isshape)
    Example (points2shape):< < 0,0>,< 3,0>,< 2,4>,< 1,2>> == < < 3,-1,-1>,< 0,4,-2>>

  • Polypoint point primitive generator
    Pre/Post conds (points::ismat) => (ispol)
    Example (join ~ polypoint):< < 0,-0.23>,< 20,0>,< 5.77,11>,< 20,-10>>

  • Polyline generator of 1D connected complexes from the points sequence
    Pre/Post conds (points::ismat) => (ispol)
    Example polyline:< < 1,0,-5.1>,< 1,1.2,0>,< 0,2,-2>,< -1,-1.25,4>>

  • Polymarker returns a complex of markers generated at specified points
    Pre/Post conds (markertype::isintpos)(points::ismat) => (ispol)
    Example polymarker:3:
    ((aa:[id,sin] ~ c:al:0 ~ progressivesum ~ #:24):(pi/12))

  • Quadmesh generator of a mesh of quadrilaterals from an array of points
    Pre/Post conds (points::ismatof:ispoint) => (ispol)
    Example quadmesh:< < < 0,0>,< 1,0>,< 2,0>>, < < 0,1>,< 1,1>,< 2,1>>,
    < < 0,2>,< 1,2>,< 2,2>> >

  • Shape2points operator to return a point sequence from the arg shape
    Pre/Post conds (arg::isshape) => (isseqof:ispoint)
    Example shape2points:< < 1,2,3>,< 0,1,0>> == < < 0,0>,< 1,0>,< 3,1>,< 6,1>>

  • Shape2pol operator to return a polyhedral complex from the arg shape
    Pre/Post conds (arg::isshape) => (ispol)
    Example shape2pol:< < 1,2,3>,< 0,1,0>> == polcomplex< 1,2>

  • Shapeclosed mapping from a d-shape to a (d+1)-shape, that adds a final tangent
    vector to close the arg shape
    Pre/Post conds (arg::isshape) => (isshape)
    Example shapeclosed:< < 1,2,3>,< 0,1,0>> == < < 1,2,3,-6>,< 0,1,0,-1>>

  • Shapecomb operator to linearly combine the input shapes, returning ap + bq
    Pre/Post conds (a,b::isreal; p,q::isshape) => (isshape)
    Example shapecomb:< 0.5,0.5,< < 1,0,1>,< 2,-1,3>>,< < 0,2,2>,< -0.5,-1,0>>>

  • Shapediff difference operator between p and q shapes
    Pre/Post conds (p,q::isshape) => (isshape)
    Example < < 1,0,1>,< 2,-1,3>> shapediff < < 0,2,2>,< -0.5,-1,0>>

  • Shapedist Euclidean distance computation between p and q shapes
    Pre/Post conds (p,q::isshape) => (isnum)
    Example < < 1,0,1>,< 2,-1,3>> shapedist < < 0,2,2>,< -0.5,-1,0>> == 4.60977

  • Shapeinbetweening returns the polyhedral complex of n shapes on the s
    Pre/Post conds (tx::isreal)(n::isint)(p,q::isshape) => (ispol)
    Example ShapeInBetweening:0:4< < < 1,0,1>,< 2,-1,3>>,< < 0,2,2>,< -0.5,-1,0>>>

  • Shapeinf returns the inferior shape of the p input shape
    Pre/Post conds (p::isshape) => (isshape)
    Example (shape2pol ~ shapeinf):< < 5,3,-2.5,-2.5,2.5>,< 0,4,-2,2,-2>>

  • Shapejoin joins two shapes and returns a shape value
    Pre/Post conds (p,q::isshape) => (isshape)
    Example shapejoin:< < < 1,0,1>,< 2,-1,3>>,< < 0,2,2>,< -0.5,-1,0>>>

  • Shapelen returns the sum of lengths of tangent vectors of p
    Pre/Post conds (p::isshape) => (isnum)
    Example shapelen:< < 1,0,1>,< 2,-1,3>> == 6.39834563766817

  • Shapenormal returns a shape whose tangent vectors are normal to those of p
    Pre/Post conds (p::isshape) => (isshape)
    Example (struct ~ aa:shape2pol ~ [id,shapenormal]):< < 1,0,1>,< 2,-1,3>>

  • Shapenorm returns the Euclidean norm of p as a vector in IR2n
    Pre/Post conds (p::isshape) => (isnum)
    Example shapenorm:< < 1,0,1>,< 2,-1,3>> == 4

  • Shapeprod product of the p (shape) vector times the alpha scalar
    Pre/Post conds (alpha::isreal; p::isshape) => (isshape)
    Example shapeprod:< 3,< < 1,0,1>,< 2,-1,3>>> == < < 3,0,3>,< 6,-3,9>>

  • Shaperot rotation of angle α of the p shape
    Pre/Post conds (alpha::isreal)(p::isshape) => (isshape)
    Example shaperot:(pi/6):< < 1,0,1>,< 2,-1,3>>

  • Shapesum addition operation between p and q shapes in their vector space
    Pre/Post conds (p,q::isshape) => (isshape)
    Example < < 1,0,1>,< 2,-1,3>> shapesum < < 0,2,2>,< -0.5,-1,0>> ==
    < < 1,2,3>,< 1.5,-2,3>>

  • Shapesup returns the superior shape of the p input shape
    Pre/Post conds (p::isshape) => (isshape)
    Example (shape2pol ~ shapesup):< < 5,3,-2.5,-2.5,2.5>,< 0,4,-2,2,-2>>

  • Shapezero returns the neutral (zero) element of the vector space of n-shapes
    Pre/Post conds (n::isint) => (isshape)
    Example shapezero:4 == < < 0,0,0,0>,< 0,0,0,0>>

  • Star 2D star primitive with n tips
    Pre/Post conds (n::isintpos) => (ispol)
    Example (struct ~ [@1 * k:(q:0.5), embed:1] ~ star):5 == polcomplex{2,3}

  • Trianglefan multidimensional primitive with the first element of verts as pivot
    Pre/Post conds (verts::isseqof:ispoint) => (ispol)
    Example trianglefan:< < 0,0,0>,< 1,0,0>,< 1,0,4>,< 0,0,4>,< 0,1,4>,< 0,1,0>>

  • Trianglestripe multidimensional primitive giving a complex of oriented triangles
    Pre/Post conds (verts::isseqof:ispoint) => (ispol)
    Example triangleStripe:< < 0,3>,< 1,2>,< 3,3>,< 2,2>,< 3,0>,< 2,1>,< 0,0>,
    < 1,1>,< 0,3>,< 1,2>> 

PLaSM is Free Software and may be distributed under GNU LGPL