public static void ReadDistanceSchema() { // Get the Schema for distance functions from the DLL int schemaLength = GetDistanceSchemaLength(); StringBuilder sb = new StringBuilder(schemaLength); GetDistanceSchema(sb); using (XmlReader reader = XmlReader.Create(new StringReader(sb.ToString()))) { while (reader.NodeType != XmlNodeType.EndElement && reader.Read()) { if (reader.NodeType == XmlNodeType.Element && reader.Name == "DISTANCESCHEMA") { while (reader.Read() && reader.NodeType != XmlNodeType.EndElement) { if (reader.NodeType == XmlNodeType.Element && (reader.Name == "FLOATFUNC" || reader.Name == "VECFUNC" || reader.Name == "NULLFUNC")) { DistFunc newFunc = new DistFunc(); newFunc.Read(reader); _DistFunc.Add(newFunc); } if (reader.NodeType == XmlNodeType.Element && (reader.Name == "FLOATVAR" || reader.Name == "VECVAR")) { FuncVar newVar = new FuncVar(); newVar.Read(reader); _FuncVar.Add(newVar); } } } } } }
public float Distance(DistFunc dist) { float min = float.PositiveInfinity; foreach (var(i, j) in this.CollidablePairs()) { float d = dist(i, j); if (d < min) { min = d; } } return(min); }
public override void Update(DistFunc dist) { }
public abstract void Update(DistFunc dist);