/// <summary> /// Returns the reference point around which we search for / add / remove floating objects close to this connector. /// The point is determined by the "Side" field of the connector and by its eventual connection to another tile. /// </summary> public Point3D SidePoint(Point3D position) { if (Side == Tile.SideType.undef && ConnectedTo != null && ConnectedTo.Side != Tile.SideType.undef) { return(ConnectedTo.SidePoint(position)); } return(OnTile.SidePoint(position, Side)); }
/// <summary> /// Releases signal objects emited by a newly established connection to the floating objects world. /// </summary> /// <param name="connector">Old connector to which a new connector was attached.</param> private void ReleaseSignalObjects(ConnectorOnTileInSpace connector) { NamedMultiset signalObjects; if (v_MSystem.GlueRelation.TryGetValue(Tuple.Create(connector.Glue, connector.ConnectedTo.Glue), out signalObjects)) { v_FltObjectsWorld.AddAt(signalObjects, connector.SidePoint(connector.Positions.First())); } }
/// <summary> /// Gets the set of floating objects within the reaction distance from any position of a given connector. /// Only objects unused in this simulation step are considered. /// TODO low priority: return floating objects close to the whole shape of the connector except endpoints /// </summary> public FloatingObjectsSet GetNearObjects(ConnectorOnTileInSpace connector, NamedMultiset targetMultiset) { FloatingObjectsSet objectsSet = new FloatingObjectsSet(); foreach (var position in connector.Positions) { objectsSet.UnionWith(GetNearObjects(connector.SidePoint(position), targetMultiset)); } return(objectsSet); }