示例#1
0
R2Vector 
operator/(const R2Vector& vector, double a)
{
  assert(a != 0);
  return R2Vector(vector.X() / a, 
                  vector.Y() / a);
}
示例#2
0
    R2Vector 
operator*(const R2Vector& vector1, const R2Vector& vector2)
{
    // Entry by entry multiply (not dot or cross product)
    return R2Vector(vector1.v[0] * vector2.v[0], 
            vector1.v[1] * vector2.v[1]);
}
示例#3
0
R2Vector operator/(const R2Vector& vector1, const R2Vector& vector2)
{
    assert(vector2.v[0] != 0);
    assert(vector2.v[1] != 0);
    return R2Vector(vector1.v[0] / vector2.v[0], 
            vector1.v[1] / vector2.v[1]);
}
示例#4
0
R2Line::
R2Line(const R2Point& point1, const R2Point& point2)
     : vector(point2 - point1)
{
    this->vector.Normalize();
    normal = R2Vector(this->vector.Y(), -(this->vector.X()));
    c = -(normal.X()*point1.X() + normal.Y()*point1.Y());
}
示例#5
0
R2Line::
R2Line(const R2Point& point, const R2Vector& vector, RNBoolean normalized)
    : vector(vector)
{
    if (!normalized) this->vector.Normalize();
    normal = R2Vector(this->vector.Y(), -(this->vector.X()));
    c = -(normal.X()*point.X() + normal.Y()*point.Y());
}
示例#6
0
void R2Line::
Align(const R2Vector& vector, RNBoolean normalized)
{
    // Set vector of line
    this->vector = vector;
    if (!normalized) this->vector.Normalize();
    this->normal = R2Vector(this->vector.Y(), -this->vector.X());
}
示例#7
0
R2Vector
operator*(const R3Matrix& a, const R2Vector& v)
{
    // Multiply matrix by vector
    RNCoord x = a.m[0][0] * v.X() + a.m[0][1] * v.Y();
    RNCoord y = a.m[1][0] * v.X() + a.m[1][1] * v.Y();
    return R2Vector(x, y);
}
示例#8
0
R2Line::
R2Line(RNCoord x1, RNCoord y1, RNCoord x2, RNCoord y2)
    : vector(x2-x1, y2-y1)
{
    this->vector.Normalize();
    normal = R2Vector(this->vector.Y(), -(this->vector.X()));
    c = -(normal.X()*x1 + normal.Y()*y1);
}
示例#9
0
void R2Line::
Mirror(const R2Line& line)
{
    // Mirror line over another line
    R2Point p = (normal * -c).Point();
    p.Mirror(line);
    vector.Mirror(line);
    normal = R2Vector(vector.Y(), -(vector.X()));
    c = -(normal.X()*p.X() + normal.Y()*p.Y());
}
示例#10
0
void R2Line::
InverseTransform (const R2Transformation& transformation)
{
    // Inverse Transform line
    vector.InverseTransform(transformation);
    vector.Normalize();
    normal = R2Vector(vector.Y(), -vector.X());
    R2Point p(Point());
    p.InverseTransform(transformation);
    Reposition(p);
}
示例#11
0
void GWindow::drawLineRel(double dx, double dy) {
    drawLineRel(R2Vector(dx, dy));
}
示例#12
0
R2Vector 
operator-(const R2Point& point1, const R2Point& point2)
{
    return R2Vector(point1.v[0] - point2.v[0], 
		    point1.v[1] - point2.v[1]);
}
示例#13
0
R2Vector operator*(const R2Vector& vector, double a)
{
    return R2Vector(vector.X() * a, 
            vector.Y() * a);
}
示例#14
0
    R2Vector 
operator-(const R2Vector& vector1, const R2Vector& vector2)
{
    return R2Vector(vector1.v[0] - vector2.v[0], 
            vector1.v[1] - vector2.v[1]);
}
示例#15
0
R2Vector operator-(const R2Vector& vector)
{
    return R2Vector(-vector.X(), 
            -vector.Y());
}
示例#16
0
R2Halfspace::
R2Halfspace(const R2Point& point, const R2Vector& normal)
    : line(point, R2Vector(-normal.Y(), normal.X()))
{
}
示例#17
0
/* Source file for the GAPS diad class */



/* Include files */

#include "R2Shapes/R2Shapes.h"



/* Public variables */

const R2Diad R2xy_diad(R2Vector(1.0, 0.0), R2Vector(0.0, 1.0));



/* Public functions */

int R2InitDiad()
{
    /* Return success */
    return TRUE;
}



void R2StopDiad()
{
}

示例#18
0
R2Vector R2Point::
Vector(void) const
{
  // Return vector to point from origin
  return R2Vector(v[0], v[1]);
}
示例#19
0
void GWindow::moveRel(double dx, double dy) {
    moveRel(R2Vector(dx, dy));
}