/// <summary> /// Draws the trail as a dotted line, fading away with age. /// </summary> public void Draw(IAnnotationService annotation) { int index = _currentIndex; for (int j = 0; j < _vertices.Length; j++) { // index of the next vertex (mod around ring buffer) int next = (index + 1) % _vertices.Length; // "tick mark": every second, draw a segment in a different color bool tick = ((_flags[index] & 2) != 0 || (_flags[next] & 2) != 0); Color color = tick ? _tickColor : _trailColor; // draw every other segment if ((_flags[index] & 1) != 0) { if (j == 0) { // draw segment from current position to first trail point annotation.Line(_currentPosition, _vertices[index], color.ToVector3().FromXna()); } else { // draw trail segments with opacity decreasing with age const float MIN_O = 0.05f; // minimum opacity float fraction = (float)j / _vertices.Length; float opacity = (fraction * (1 - MIN_O)) + MIN_O; annotation.Line(_vertices[index], _vertices[next], color.ToVector3().FromXna(), opacity); } } index = next; } }
public SoccerPlugIn(IAnnotationService annotations = null) :base(annotations) { _teamA = new List<Player>(); _teamB = new List<Player>(); _allPlayers = new List<Player>(); }
// Constructor: initializes state protected SteerLibrary(IAnnotationService annotationService = null) { annotation = annotationService ?? new NullAnnotationService(); // set inital state Reset(); }
// constructor protected PlugIn(IAnnotationService annotations) { Annotations = annotations; // save this new instance in the registry AddToRegistry(); }
public SoccerPlugIn(IAnnotationService annotations = null) : base(annotations) { _teamA = new List <Player>(); _teamB = new List <Player>(); _allPlayers = new List <Player>(); }
public Service(IEmailService emailService, IIdentityService identityService, IRabbitMQService rabbitMQService, IAzureBlobService azureBlobService, IAnnotationService annotationService, IAnswerService answerService, IEssayExerciseService essayExerciseService, ILogService logService, IMultipleChoicesExerciseService multipleChoicesExerciseService, IStudentService studentService, ITestService testService, IMultipleChoicesAnswerService multipleChoicesAnswerService, IEssayAnswerService essayAnswerService) { EmailService = emailService; IdentityService = identityService; RabbitMQService = rabbitMQService; AzureBlobService = azureBlobService; AnnotationService = annotationService; AnswerService = answerService; EssayExerciseService = essayExerciseService; LogService = logService; MultipleChoicesExerciseService = multipleChoicesExerciseService; StudentService = studentService; TestService = testService; EssayAnswerService = essayAnswerService; MultipleChoicesAnswerService = multipleChoicesAnswerService; }
// constructor protected CtfBase(CtfPlugIn plugin, IAnnotationService annotations = null, float baseRadius = 1.5f) : base(annotations) { Plugin = plugin; _baseRadius = baseRadius; Reset(); }
// constructor protected CtfBase(CtfPlugIn plugin, IAnnotationService annotations = null, float baseRadius = 1.5f) :base(annotations) { Plugin = plugin; _baseRadius = baseRadius; Reset(); }
public AnnotationController(IAnnotationService annotationSvc) { _resourceManager = new EmbeddedResourceManager(); _annotationSvc = annotationSvc; //Here you should apply proper GroupDocs.Annotation license (in case you want to //use this sample without trial limits) //new License().SetLicense("C:/annotation.net/resources/licenses/GroupDocs.Annotation_26_06_2015.lic"); }
public AnnotationController(IAnnotationService annotationSvc) { _resourceManager = new EmbeddedResourceManager(); _annotationSvc = annotationSvc; //Here you should apply proper GroupDocs.Annotation license (in case you want to //use this sample without trial limits) new License().SetLicense("E:/GroupDocs.Total.lic"); }
// constructor public SimpleVehicle(IAnnotationService annotations = null) : base(annotations) { // set inital state Reset(); // maintain unique serial numbers SerialNumber = _serialNumberCounter++; }
public CtfPlugIn(IAnnotationService annotations, int enemyCount = 6, bool arrive = false, float baseRadius = 1.5f, int obstacles = 50) : base(annotations) { _arrive = arrive; BaseRadius = baseRadius; _obstacles = obstacles; CtfEnemies = new CtfEnemy[enemyCount]; _all = new List <CtfBase>(); }
// constructor public Pedestrian(IProximityDatabase <IVehicle> pd, IAnnotationService annotations = null) : base(annotations) { // allocate a token for this boid in the proximity database _proximityToken = null; NewPD(pd); // reset Pedestrian state Reset(); }
public CtfPlugIn(IAnnotationService annotations, int enemyCount = 6, bool arrive = false, float baseRadius = 1.5f, int obstacles = 50) :base(annotations) { _arrive = arrive; BaseRadius = baseRadius; _obstacles = obstacles; CtfEnemies = new CtfEnemy[enemyCount]; _all = new List<CtfBase>(); }
// constructor public Player(List<Player> others, List<Player> allplayers, Ball ball, bool isTeamA, int id, IAnnotationService annotations = null) :base(annotations) { _allPlayers = allplayers; _ball = ball; _imTeamA = isTeamA; _myID = id; Reset(); }
public QuestionsController( ISearchDataService dataService, ISharedService sharedService, IAnnotationService annotationService, IHistoryService historyService) { _dataService = dataService; _sharedService = sharedService; _historyService = historyService; _annotationService = annotationService; }
public Missile(IProximityDatabase <IVehicle> proximity, IVehicle target, IAnnotationService annotation) : base(annotation) { _trail = new Trail(1, 10) { TrailColor = Color.Red, TickColor = Color.DarkRed }; _proximityToken = proximity.AllocateToken(this); Target = target; }
public Missile(IProximityDatabase<IVehicle> proximity, IVehicle target, IAnnotationService annotation) :base(annotation) { _trail = new Trail(1, 10) { TrailColor = Color.Red, TickColor = Color.DarkRed }; _proximityToken = proximity.AllocateToken(this); Target = target; }
public Fighter(IProximityDatabase<IVehicle> proximity, IAnnotationService annotation, Action<Fighter, Fighter> fireMissile) :base(annotation) { _trail = new Trail(5, 50) { TrailColor = Color.WhiteSmoke, TickColor = Color.LightGray }; _proximityToken = proximity.AllocateToken(this); _fireMissile = fireMissile; }
// constructor public Boid(IProximityDatabase <IVehicle> pd, IAnnotationService annotations = null) : base(annotations) { // allocate a token for this boid in the proximity database _proximityToken = null; NewPD(pd); _trail = new Trail(2f, 60); // reset all boid state Reset(); }
// constructor public Boid(IProximityDatabase<IVehicle> pd, IAnnotationService annotations = null) :base(annotations) { // allocate a token for this boid in the proximity database _proximityToken = null; NewPD(pd); _trail = new Trail(2f, 60); // reset all boid state Reset(); }
public Fighter(IProximityDatabase <IVehicle> proximity, IAnnotationService annotation, Action <Fighter, Fighter> fireMissile) : base(annotation) { _trail = new Trail(5, 50) { TrailColor = Color.WhiteSmoke, TickColor = Color.LightGray }; _proximityToken = proximity.AllocateToken(this); _fireMissile = fireMissile; }
public void HandleEvent(string path, IAnnotationService svc) { var un = HttpContext.Current.Session["UserName"] != null ? HttpContext.Current.Session["UserName"].ToString() : ""; //var svc = UnityConfig.GetConfiguredContainer().Resolve<IAnnotationService>(); if (!string.IsNullOrEmpty(un)) { // add user to the document collaborator list svc.AddCollaborator(path, un, null, null, null); } else { svc.AddCollaborator(path, "*****@*****.**", "Anonym", "A.", null); // allow anonymous users to annotate on a document } }
private void CheckingRepositoriesAndServices() { _incidentXrmRepository = _repositoryNinjectFactory.IncidentXrmRepository(); if (_incidentXrmRepository == null) { throw new NullReferenceException("IncidentXrmRepository is null"); } _sqlService = _internalServiceFactory.SqlService(); if (_sqlService == null) { throw new NullReferenceException("SqlService is null"); } _incidentService = _internalServiceFactory.IncidentService(); if (_incidentService == null) { throw new NullReferenceException("IncidentService is null"); } _systemUserService = _internalServiceFactory.SystemUserService(); if (_systemUserService == null) { throw new NullReferenceException("SystemUserService is null"); } _phoneCallService = _internalServiceFactory.PhoneCallService(); if (_phoneCallService == null) { throw new NullReferenceException("PhoneCallService is null"); } _emailService = _internalServiceFactory.EmailService(); if (_emailService == null) { throw new NullReferenceException("EmailService is null"); } _annotationService = _internalServiceFactory.AnnotationService(); if (_annotationService == null) { throw new NullReferenceException("AnnotationService is null"); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { // Register and initialize once only, all other methods will use and share same objects/configs. // initializing AnnotationImageHandler object. annotator = UnityConfig.GetConfiguredContainer().Resolve <AnnotationImageHandler>(); // initializing EmbeddedResourceManager object. _resourceManager = new EmbeddedResourceManager(); //AnnotationHub.userGUID = "52ced024-26e0-4b59-a510-ca8f5368e315"; // initializing AnnotationService object. _annotationSvc = UnityConfig.GetConfiguredContainer().Resolve <IAnnotationService>(); //Here you should apply proper GroupDocs.Annotation license (in case you want to //use this sample without trial limits) License lic = new License(); lic.SetLicense("E:/GroupDocs.Total.lic"); } }
// constructor public MapDriver(IAnnotationService annotations = null) :base(annotations) { Map = MakeMap(); Path = MakePath(); Reset(); // to compute mean time between collisions SumOfCollisionFreeTimes = 0; CountOfCollisionFreeTimes = 0; // keep track for reliability statistics _collisionLastTime = false; TimeOfLastCollision = Demo.Clock.TotalSimulationTime; // keep track of average speed TotalDistance = 0; TotalTime = 0; // innitialize counters for various performance data StuckCount = 0; StuckCycleCount = 0; StuckOffPathCount = 0; LapsStarted = 0; LapsFinished = 0; HintGivenCount = 0; HintTakenCount = 0; // follow the path "upstream or downstream" (+1/-1) PathFollowDirection = -1; // use curved prediction and incremental steering: CurvedSteering = true; IncrementalSteering = true; }
// constructor public CtfEnemy(CtfPlugIn plugin, IAnnotationService annotations = null) : base(plugin, annotations) { Reset(); }
public MapDrivePlugIn(IAnnotationService annotations) :base(annotations) { _vehicles = new List<MapDriver>(); }
// constructor public MpWanderer(IAnnotationService annotations = null) : base(annotations) { Reset(); }
// constructor public MpPursuer(MpWanderer w, IAnnotationService annotations = null) :base(annotations) { _wanderer = w; Reset(); }
// constructor public Pedestrian(IProximityDatabase<IVehicle> pd, IAnnotationService annotations = null) :base(annotations) { // allocate a token for this boid in the proximity database _proximityToken = null; NewPD(pd); // reset Pedestrian state Reset(); }
public BoidsPlugIn(IAnnotationService annotations) :base(annotations) { _flock = new List<Boid>(); }
public AnnotationWidget(IAuthenticationService authSvc, IAnnotationService annotationSvc) { _authSvc = authSvc; _annotationSvc = annotationSvc; }
/// <summary> /// tries to maintain a given speed, returns a maxForce-clipped steering /// force along the forward/backward axis /// </summary> /// <param name="vehicle"></param> /// <param name="targetSpeed"></param> /// <param name="maxForce"></param> /// <param name="annotation"></param> /// <returns></returns> public static Vector3 SteerForTargetSpeed(this IVehicle vehicle, float targetSpeed, float maxForce, IAnnotationService annotation = null) { float mf = maxForce; float speedError = targetSpeed - vehicle.Speed; return(vehicle.Forward * MathHelper.Clamp(speedError, -mf, +mf)); }
/// <summary> /// Unaligned collision avoidance behavior: avoid colliding with other /// nearby vehicles moving in unconstrained directions. Determine which /// (if any) other other this we would collide with first, then steers /// to avoid the site of that potential collision. Returns a steering /// force vector, which is zero length if there is no impending collision. /// </summary> /// <param name="vehicle"></param> /// <param name="minTimeToCollision"></param> /// <param name="others"></param> /// <param name="annotation"></param> /// <returns></returns> public static Vector3 SteerToAvoidNeighbors(this IVehicle vehicle, float minTimeToCollision, IEnumerable <IVehicle> others, IAnnotationService annotation = null) { // first priority is to prevent immediate interpenetration Vector3 separation = SteerToAvoidCloseNeighbors(vehicle, 0, others, annotation); if (separation != Vector3.Zero) { return(separation); } // otherwise, go on to consider potential future collisions float steer = 0; IVehicle threat = null; // Time (in seconds) until the most immediate collision threat found // so far. Initial value is a threshold: don't look more than this // many frames into the future. float minTime = minTimeToCollision; // xxx solely for annotation Vector3 xxxThreatPositionAtNearestApproach = Vector3.Zero; Vector3 xxxOurPositionAtNearestApproach = Vector3.Zero; // for each of the other vehicles, determine which (if any) // pose the most immediate threat of collision. foreach (IVehicle other in others) { if (other != vehicle) { // avoid when future positions are this close (or less) float collisionDangerThreshold = vehicle.Radius * 2; // predicted time until nearest approach of "this" and "other" float time = PredictNearestApproachTime(vehicle, other); // If the time is in the future, sooner than any other // threatened collision... if ((time >= 0) && (time < minTime)) { // if the two will be close enough to collide, // make a note of it if (ComputeNearestApproachPositions(vehicle, other, time) < collisionDangerThreshold) { minTime = time; threat = other; } } } } // if a potential collision was found, compute steering to avoid if (threat != null) { // parallel: +1, perpendicular: 0, anti-parallel: -1 float parallelness = Vector3.Dot(vehicle.Forward, threat.Forward); const float ANGLE = 0.707f; if (parallelness < -ANGLE) { // anti-parallel "head on" paths: // steer away from future threat position Vector3 offset = xxxThreatPositionAtNearestApproach - vehicle.Position; float sideDot = Vector3.Dot(offset, vehicle.Side); steer = (sideDot > 0) ? -1.0f : 1.0f; } else { if (parallelness > ANGLE) { // parallel paths: steer away from threat Vector3 offset = threat.Position - vehicle.Position; float sideDot = Vector3.Dot(offset, vehicle.Side); steer = (sideDot > 0) ? -1.0f : 1.0f; } else { // perpendicular paths: steer behind threat // (only the slower of the two does this) if (threat.Speed <= vehicle.Speed) { float sideDot = Vector3.Dot(vehicle.Side, threat.Velocity); steer = (sideDot > 0) ? -1.0f : 1.0f; } } } if (annotation != null) { annotation.AvoidNeighbor(threat, steer, xxxOurPositionAtNearestApproach, xxxThreatPositionAtNearestApproach); } } return(vehicle.Side * steer); }
// constructor public OneTurning(IAnnotationService annotations = null) :base(annotations) { Reset(); }
public static Vector3 SteerForEvasion(this IVehicle vehicle, IVehicle menace, float maxPredictionTime, float maxSpeed, IAnnotationService annotation = null) { // offset from this to menace, that distance, unit vector toward menace Vector3 offset = menace.Position - vehicle.Position; float distance = offset.Length(); float roughTime = distance / menace.Speed; float predictionTime = ((roughTime > maxPredictionTime) ? maxPredictionTime : roughTime); Vector3 target = menace.PredictFuturePosition(predictionTime); return(SteerForFlee(vehicle, target, maxSpeed, annotation)); }
public SimpleVehicle(IAnnotationService annotations = null) : base(annotations) { }
public PathWalker(IPathway path, IAnnotationService annotation, List<PathWalker> vehicles) :base(annotation) { Path = path; _vehicles = vehicles; }
public ArrivalPlugIn(IAnnotationService annotations) :base(annotations, 0, true, 0.5f, 100) { }
public FlowFieldPlugIn(IAnnotationService annotations) : base(annotations) { PredictionTime = 1; Database = new LocalityQueryProximityDatabase<IVehicle>(Vector3.Zero, new Vector3(250, 250, 250), new Vector3(10)); }
// constructor protected MpBase(IAnnotationService annotations = null) :base(annotations) { Reset(); }
public static Vector3 SteerToStayOnPath(this IVehicle vehicle, float predictionTime, IPathway path, float maxSpeed, IAnnotationService annotation = null) { // predict our future position Vector3 futurePosition = vehicle.PredictFuturePosition(predictionTime); // find the point on the path nearest the predicted future position Vector3 tangent; float outside; Vector3 onPath = path.MapPointToPath(futurePosition, out tangent, out outside); if (outside < 0) { return(Vector3.Zero); // our predicted future position was in the path, return zero steering. } // our predicted future position was outside the path, need to // steer towards it. Use onPath projection of futurePosition // as seek target if (annotation != null) { annotation.PathFollowing(futurePosition, onPath, onPath, outside); } return(vehicle.SteerForSeek(onPath, maxSpeed)); }
private string _storagePath = AppDomain.CurrentDomain.GetData("DataDirectory") + "/"; // App_Data folder path #endregion Fields #region Constructors public AnnotationWidget(IAuthenticationService authSvc, IAnnotationService annotationSvc) { _authSvc = authSvc; _annotationSvc = annotationSvc; }
public static Vector3 SteerToFollowPath(this IVehicle vehicle, bool direction, float predictionTime, IPathway path, float maxSpeed, IAnnotationService annotation = null) { float pathDistance; return(SteerToFollowPath(vehicle, direction, predictionTime, path, maxSpeed, out pathDistance, annotation)); }
public OneTurningPlugIn(IAnnotationService annotations) :base(annotations) { _theVehicle = new List<OneTurning>(); }
public static Vector3 SteerToFollowPath(this IVehicle vehicle, bool direction, float predictionTime, IPathway path, float maxSpeed, out float currentPathDistance, IAnnotationService annotation = null) { // our goal will be offset from our path distance by this amount float pathDistanceOffset = (direction ? 1 : -1) * predictionTime * vehicle.Speed; // predict our future position Vector3 futurePosition = vehicle.PredictFuturePosition(predictionTime); // measure distance along path of our current and predicted positions currentPathDistance = path.MapPointToPathDistance(vehicle.Position); float futurePathDistance = path.MapPointToPathDistance(futurePosition); // are we facing in the correction direction? bool rightway = ((pathDistanceOffset > 0) ? (currentPathDistance < futurePathDistance) : (currentPathDistance > futurePathDistance)); // find the point on the path nearest the predicted future position Vector3 tangent; float outside; Vector3 onPath = path.MapPointToPath(futurePosition, out tangent, out outside); // no steering is required if (a) our future position is inside // the path tube and (b) we are facing in the correct direction if ((outside <= 0) && rightway) { //We're going at max speed, in the right direction. don't need to do anything if (vehicle.Speed >= maxSpeed) { return(Vector3.Zero); } //Predict vehicle position and sample multiple times, incresingly far along the path var seek = path.MapPointToPath(vehicle.PredictFuturePosition(predictionTime / 3), out tangent, out outside); for (int i = 0; i < 3; i++) { var s = path.MapPointToPath(seek + tangent * vehicle.Speed / (i + 1), out tangent, out outside); //terminate search if we wander outside the path if (outside > 0) { break; } seek = s; if (annotation != null) { annotation.Circle3D(0.3f, seek, Vector3.Up, Color.Green, 6); } } //Steer towards future path point return(vehicle.SteerForSeek(seek, maxSpeed, annotation)); } // otherwise we need to steer towards a target point obtained // by adding pathDistanceOffset to our current path position float targetPathDistance = currentPathDistance + pathDistanceOffset; Vector3 target = path.MapPathDistanceToPoint(targetPathDistance); if (annotation != null) { annotation.PathFollowing(futurePosition, onPath, target, outside); } // return steering to seek target on path return(SteerForSeek(vehicle, target, maxSpeed)); }
public GatewayPathFollowingPlugin(IAnnotationService annotations) :base(annotations) { }
public LowSpeedTurnPlugIn(IAnnotationService annotations) : base(annotations) { _all = new List <LowSpeedTurn>(); }
// constructor public LowSpeedTurn(IAnnotationService annotations = null) : base(annotations) { Reset(); }
public PedestrianPlugIn(IAnnotationService annotations) :base(annotations) { _crowd = new List<Pedestrian>(); }
public MpPlugIn(IAnnotationService annotations) :base(annotations) { _allMp = new List<MpBase>(); }
// constructor public LowSpeedTurn(IAnnotationService annotations = null) :base(annotations) { Reset(); }
public MapDrivePlugIn(IAnnotationService annotations) : base(annotations) { _vehicles = new List <MapDriver>(); }
public static Vector3 SteerToFollowFlowField(this IVehicle vehicle, IFlowField flowField, float maxSpeed, float predictionDistance, IAnnotationService annotation = null) { var futurePosition = vehicle.PredictFuturePosition(predictionDistance); var flow = flowField.Sample(futurePosition); return(vehicle.Velocity - flow.TruncateLength(maxSpeed)); }
public Ball(AABBox bbox, IAnnotationService annotations = null) :base(annotations) { _mBbox = bbox; Reset(); }