public bool Parallel(CLine line) { bool bParallel = false; if (this.a / this.b == line.a / line.b) { bParallel = true; } return(bParallel); }
/************************************** * Calculate intersection point of two lines * if two lines are parallel, return null * ************************************/ public CPoint2D IntersecctionWith(CLine line) { CPoint2D point = new CPoint2D(); float a1 = this.a; float b1 = this.b; float c1 = this.c; float a2 = line.a; float b2 = line.b; float c2 = line.c; if (!(this.Parallel(line))) //not parallen { point.X = (c2 * b1 - c1 * b2) / (a1 * b2 - a2 * b1); point.Y = (a1 * c2 - c1 * a2) / (a2 * b2 - a1 * b2); } return(point); }
/************************************** Calculate intersection point of two lines if two lines are parallel, return null * ************************************/ public CPoint2D IntersecctionWith(CLine line) { CPoint2D point = new CPoint2D(); float a1 = this.a; float b1 = this.b; float c1 = this.c; float a2 = line.a; float b2 = line.b; float c2 = line.c; if (!(this.Parallel(line))) //not parallen { point.X = (c2 * b1 - c1 * b2) / (a1 * b2 - a2 * b1); point.Y = (a1 * c2 - c1 * a2) / (a2 * b2 - a1 * b2); } return point; }
public bool Parallel(CLine line) { bool bParallel = false; if (this.a / this.b == line.a / line.b) bParallel = true; return bParallel; }
public CLine(CLine copiedLine) { this.a = copiedLine.a; this.b = copiedLine.b; this.c = copiedLine.c; }
public CLine(CLine copiedLine) { this.a = copiedLine.a; this.b = copiedLine.b; this.c = copiedLine.c; }