Search processing.org:

Reference for Processing version 1.0+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Class | PVector
Name | ### mult()
Examples |
    PVector v;

    void setup() {
      smooth();
      noLoop();
      v = new PVector(5, 10, 0);
    }

    void draw() {
      ellipse(v.x, v.y, 12, 12);
      v.mult(6);
      ellipse(v.x, v.y, 24, 24);
    }
    PVector v1, v2;

    void setup() {
      smooth();
      noLoop();
      v1 = new PVector(5, 10, 0);
      v2 = new PVector(15, 8, 0);
    }

    void draw() {
      ellipse(v1.x, v1.y, 12, 12);
      ellipse(v2.x, v2.y, 12, 12);
      v1.mult(v2);
      ellipse(v1.x, v1.y, 24, 24);
    }
    PVector v1;

    void setup() {
      smooth();
      noLoop();
      v1 = new PVector(5, 10, 0);
    }

    void draw() {
      ellipse(v1.x, v1.y, 12, 12);
      PVector v2 = PVector.mult(v1, 6);
      ellipse(v2.x, v2.y, 24, 24);
    }
    PVector v1, v2;

    void setup() {
      smooth();
      noLoop();
      v1 = new PVector(5, 10, 0);
      v2 = new PVector(15, 8, 0);
    }

    void draw() {
      ellipse(v1.x, v1.y, 12, 12);
      ellipse(v2.x, v2.y, 12, 12);
      PVector v3 = PVector.mult(v1, v2);
      ellipse(v3.x, v3.y, 24, 24);
    }
Description | Multiplies a vector by a scalar or multiplies one vector by another.
Syntax |
    vec.mult(scalar)
    vec.mult(v)
    PVector.mult(v, scalar)
    PVector.mult(v1, v2)
Parameters |
vec | any variable of type PVector
scalar | float: the number to multiply with the vector
v | PVector: the vector to multiply by the scalar
v1 | PVector: the x, y, and z components of a PVector object
v2 | PVector: the x, y, and z components of a PVector object
Returns | None or PVector
Usage | Web & Application

Updated on November 22, 2008 08:39:25pm PST