示例#1
0
 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);
     }
 }
示例#2
0
 public bool Equals(ConstVector obj)
 {
     return Equals((object)obj);
 }
示例#3
0
 public ConstAnchor(string name, ConstVector location)
 {
     _name = name;
     _location = location;
 }