PiMath API
    Preparing search index...

    Interface RandomGeometryLineConfig

    Options of rndLine.

    interface RandomGeometryLineConfig {
        A?: Point | RandomGeometryPointConfig;
        allow?: {
            horizontal?: number | boolean;
            negative?: number | boolean;
            positive?: number | boolean;
            vertical?: number | boolean;
        };
        slope?: FractionOrRandom;
    }
    Index

    Point on the line: a Point fixes it exactly (new Point(1, 2)); an object is the configuration of the random point drawn by rndPoint (default: its own defaults).

    allow?: {
        horizontal?: number | boolean;
        negative?: number | boolean;
        positive?: number | boolean;
        vertical?: number | boolean;
    }

    Kind of line that may be drawn, for a random slope. Each entry is false (never), a number between 0 and 1 (probability of that kind), or true (default):

    • vertical / horizontal (zero slope): true means a fixed probability of 5 %;
    • positive / negative (slope sign): true shares equally what the others leave.

    Probabilities that do not add up are normalized, and an explicit number takes precedence over true. Examples: { negative: false, horizontal: false, vertical: false } always gives a positive slope; { vertical: 1 } always gives a vertical line.

    Slope of the line (default: a random slope, as with { fraction: true }).

    • an exact value (2, '-3/2', new Fraction(1, 2)): the line has exactly that slope. Prefer a string for a non-terminating fraction ('1/3', not 0.333). Incompatible with an explicit allow.
    • { fraction }: a random slope, false for an integer, true for a fraction, or a RandomCoefficientConfig (e.g. max). The sign comes from allow.positive / allow.negative.