private ConstVector ConstAdd( int lineNo, IEnumerable<ConstAnchor> defs, string lhsName, ConstVector rhs, bool plus) { ConstAnchor lhsAnchor = defs.FirstOrDefault(a => a.Name == lhsName); if (lhsAnchor == null) { throw new Exception(string.Format( "Line {0}: Anchor {1} not yet defined", lineNo, lhsName)); } ConstVector lhs = lhsAnchor.Location; if (lhs.Is2D() && rhs.Is2D()) { return plus ? new ConstVector(lhs.X + rhs.X, lhs.Y + rhs.Y) : new ConstVector(lhs.X - rhs.X, lhs.Y - rhs.Y); } else { return plus ? new ConstVector(lhs.X + rhs.X, lhs.Y + rhs.Y, lhs.Z + rhs.Z) : new ConstVector(lhs.X - rhs.X, lhs.Y - rhs.Y, lhs.Z - rhs.Z); } }
public bool Equals(ConstVector obj) { return Equals((object)obj); }
public ConstAnchor(string name, ConstVector location) { _name = name; _location = location; }