public override UnitState FixedUpdate() { var globalLookDirection = Parameters.LookLogicDirection; var moveScaledLogicDirection = Parameters.MoveScaledLogicDirection; var parametersAngle = AngleCalculator.CalculateLogicAngle(moveScaledLogicDirection, globalLookDirection); var logicLookDirection = GetLogicVector(globalLookDirection); if (Mathf.Abs(parametersAngle) <= 120) { ManageReachingLegsTurnDirection(logicLookDirection, moveScaledLogicDirection.normalized); } else { ManageReachingLegsTurnDirection(logicLookDirection, -moveScaledLogicDirection.normalized); } Torso.TurnTowards(logicLookDirection); Torso.AimAt(Parameters.AimAtDirection); Legs.Move(moveScaledLogicDirection); Legs.StraightenUp(); Torso.Move(moveScaledLogicDirection); Torso.StraightenUp(); return this; }
private void Cut(WallIntersectionData data, AngleCalculator calculator, WallExtrusion extrusion) { using (TransactionGroup tranGr = new TransactionGroup(_doc)) { tranGr.Start("wall penetration one element"); var _roundOpen = _doc.GetFamilySymbol("Отверстие_Поворотное", "Отверстие"); var _rectOpen = _doc.GetFamilySymbol("ОтверстиеПрямоугольное_Поворотное", "Отверстие"); using (Transaction tran = new Transaction(_doc)) { tran.Start("Creating wall penetration"); FamilyInstance fi = _doc.Create.NewFamilyInstance(data.WallSideFaceRef, calculator.LocationPoint, new XYZ(1, 0, 0), _rectOpen); tran.Commit(); tran.Start("SetPar"); double offset = UnitUtils.ConvertToInternalUnits(0, DisplayUnitType.DUT_MILLIMETERS); fi.LookupParameter("ШиринаОтверстия").Set(extrusion.Width + offset); fi.LookupParameter("ВысотаОтверстия").Set(extrusion.Height + offset); fi.LookupParameter("УголВертикальногоПоворота").Set(calculator.VerticalAngle); fi.LookupParameter("УголГоризонтальногоПоворота").Set(calculator.HorizontalAngle); tran.Commit(); } tranGr.Assimilate(); } }
public static void Main() { IInputContainer inputContainer = new InputContainer(new ConsoleInputGetter()); IInitialCheckpointGuesser initialCheckpointGuesser = new InitialCheckpointGuesser(inputContainer); ICheckpointMemory checkpointMemory = new CheckpointMemory(); IBoostUseCalculator boostUseCalculator = new BoostUseCalculator(checkpointMemory); ISpeedCalculator speedCalculator = new SpeedCalculator(); IAngleCalculator angleCalculator = new AngleCalculator(); IGamestateCalculator gamestateCalculator = new GamestateCalculator(inputContainer); ITargetFinding targetFinding = new SmartTargetFinder(checkpointMemory, inputContainer, speedCalculator, angleCalculator); //ITargetFinding targetFinding = new SimpleTargetFinder(); ISlowDownCalculator linearMovementAngleSlowDownCalculator = new LinearMovementAngleSlowDownCalculator(null, gamestateCalculator, inputContainer, angleCalculator, checkpointMemory); ISlowDownCalculator distanceSlowDownCalculator = new SimpleDistanceSlowDownCalculator(linearMovementAngleSlowDownCalculator, checkpointMemory, inputContainer); ISlowDownCalculator hitPredictionSlowDownCalculator = new HitPredictionSlowDownCalculator(distanceSlowDownCalculator, gamestateCalculator, checkpointMemory, inputContainer); ISlowDownCalculator slowDownCalculator = new LinearAngleSlowDownCalculator(hitPredictionSlowDownCalculator, inputContainer); //ISlowDownCalculator slowDownCalculator = new SimpleAngleSlowDownCalculator(null,inputContainer); IThrustCalculator thrustCalculator = new AngleAndDistThrustCalculator(checkpointMemory, boostUseCalculator, angleCalculator, slowDownCalculator, gamestateCalculator); new Player().Start(inputContainer, initialCheckpointGuesser, checkpointMemory, boostUseCalculator, targetFinding, thrustCalculator, speedCalculator, gamestateCalculator); }
private void FamilyInstanceIntersection(Wall wall) { var intersector = GetIntersectingElement(); WallExtrusion extrusion = new WallExtrusion(intersector, wall); WallIntersectionData data = new WallIntersectionData(wall, intersector); AngleCalculator calculator = new AngleCalculator(data); Cut(data, calculator, extrusion); }
protected void ManageReachingLegsTurnDirection(Vector3 logicLookDirection, Vector3 movementTurnLogicDirection) { var legsLogicDirection = GetLogicVector(Legs.transform.forward); var torsoLogicDirection = GetLogicVector(Torso.transform.forward); var angle = AngleCalculator.CalculateLogicAngle(legsLogicDirection, movementTurnLogicDirection); Legs.TurnTowards(movementTurnLogicDirection); }
private void Cut(WallIntersectionData data, AngleCalculator calculator, IConnector connector, FamilySymbol _roundOpen, FamilySymbol _rectOpen) { using (TransactionGroup tranGr = new TransactionGroup(_doc)) { tranGr.Start("wall penetration one element"); using (Transaction tran = new Transaction(_doc)) { switch (connector?.Shape) { case ConnectorProfileType.Rectangular: tran.Start("Creating wall penetration"); FamilyInstance fi = _doc.Create.NewFamilyInstance(data.WallSideFaceRef, calculator.LocationPoint, new XYZ(1, 0, 0), _rectOpen); tran.Commit(); tran.Start("SetPar"); double offset = UnitUtils.ConvertToInternalUnits(100, DisplayUnitType.DUT_MILLIMETERS); fi.LookupParameter("ШиринаОтверстия").Set(connector.Width + offset); fi.LookupParameter("ВысотаОтверстия").Set(connector.Height + offset); fi.LookupParameter("УголВертикальногоПоворота").Set(calculator.VerticalAngle); fi.LookupParameter("УголГоризонтальногоПоворота").Set(calculator.HorizontalAngle); tran.Commit(); break; case ConnectorProfileType.Round: tran.Start("Creating wall penetration"); fi = _doc.Create.NewFamilyInstance(data.WallSideFaceRef, calculator.LocationPoint, new XYZ(1, 0, 0), _roundOpen); tran.Commit(); tran.Start("SetPar"); fi.LookupParameter("НаружныйДиаметр").Set(connector.Radius * 2 * 1.2); fi.LookupParameter("УголВертикальногоПоворота").Set(calculator.VerticalAngle); fi.LookupParameter("УголГоризонтальногоПоворота").Set(calculator.HorizontalAngle); tran.Commit(); break; } } tranGr.Assimilate(); } }
protected virtual void ProcessAngle(CarSignalInfo signalInfo) { //if (signalInfo.IsGpsValid&&signalInfo.Gps!=null) //{ // signalInfo.BearingAngle = AngleCalculator.CalculateAngle(signalInfo.Gps); //} if (Settings.AngleSource == AngleSource.GPS) { if (signalInfo.IsGpsValid && signalInfo.Sensor != null && signalInfo.Sensor.Heading > 0) { signalInfo.BearingAngle = AngleCalculator.CalculateAngle(signalInfo.Gps); } } }
public LeftSide(SpinousProcessDescription description) { parameters = new Dictionary <string, IParameterCalculator <SpinousProcessDescription> >(); names = new Dictionary <string, string>(); keys = new SortedSet <string>(); this.description = description; this.description.Direction = 1; IParameterCalculator <SpinousProcessDescription> param = new AngleCalculator(); param.Description = description; parameters["alpha"] = param; names["alpha"] = "Угол между остистыми отростками"; keys.Add("alpha"); }
void RotateToTargetAngle() { Angle = AngleCalculator.GetAngle(processor.owner.transform.forward.x, processor.owner.transform.forward.z); AngleDifference = (TargetAngle - Angle); if (Mathf.Abs(AngleDifference) > 180f) { if (AngleDifference < 0f) { AngleDifference = (360f + AngleDifference); } else if (AngleDifference > 0f) { AngleDifference = (360f - AngleDifference) * -1f; } } processor.owner.rbody.maxAngularVelocity = MaxTorque; Torque = AngleDifference * TorqueMultiplier.Evaluate(Mathf.Abs(AngleDifference) / 180f) * 20f; processor.owner.rbody.AddTorque(Vector3.up * Torque, ForceMode.VelocityChange); CancelHorizontalAngularVelocity(); }
private void MEPIntersection(Wall wall) { IEnumerable <MEPCurve> intersectElement = GetIntersectElements(wall); using (TransactionGroup tranGr = new TransactionGroup(_doc)) { tranGr.Start("wall penetration"); FamilySymbol _roundOpen = _doc.GetFamilySymbol("Отверстие_Поворотное", "Отверстие"); FamilySymbol _rectOpen = _doc.GetFamilySymbol("ОтверстиеПрямоугольное_Поворотное", "Отверстие"); foreach (MEPCurve intersector in intersectElement) { Connector connector = intersector.ConnectorManager.Connectors.Cast <Connector>().FirstOrDefault(); WallIntersectionData data = new WallIntersectionData(wall, intersector); AngleCalculator calculator = new AngleCalculator(data); Cut(data, calculator, connector, _roundOpen, _rectOpen); } tranGr.Assimilate(); } }
public Transformation calculateTransformation(List <Contour <Point> > contours_image1, List <Contour <Point> > contours_image2) { List <Feature> image1_features = new List <Feature>(); List <Feature> image2_features = new List <Feature>(); //Get the points of the FIRST (=0) contour Point[] points1 = contours_image1[0].ToArray(); //Calculate the angle at every pixel for picture 1 for (int i = 0; i < points1.Length; i++) { AngleCalculator angleCalculator = new AngleCalculator(); double angle = angleCalculator.calculateAngle(points1, i); Feature f = new Feature(); f.point = points1[i]; f.angle_at_pixel = angle; image1_features.Add(f); } //Get the points of the FIRST (=0) contour Point[] points2 = contours_image2[0].ToArray(); //Calculate the angle at every pixel for picture 2 for (int i = 0; i < points2.Length; i++) { AngleCalculator angleCalculator = new AngleCalculator(); double angle = angleCalculator.calculateAngle(points2, i); Feature f = new Feature(); f.point = points2[i]; f.angle_at_pixel = angle; image2_features.Add(f); } GraphAnalyzer graphanalyzer = new GraphAnalyzer(); //Normalize the shorter contour to longer one List <Feature> image1_features_normalized; List <Feature> image2_features_normalized; if (image1_features.Count < image2_features.Count) { image1_features_normalized = graphanalyzer.normalize(image2_features, image1_features); image2_features_normalized = image2_features; } else { image2_features_normalized = graphanalyzer.normalize(image1_features, image2_features); image1_features_normalized = image1_features; } //Moves the contour(graph) of image1 to best matching image1_features_normalized = graphanalyzer.matchGraphs(image1_features_normalized, image2_features_normalized); //Get the best Features by using extrema [0] image1 --> [1] image2, .... List <Feature> bestFeatures = graphanalyzer.findBestFeaturesWithExtrema(image1_features_normalized, image2_features_normalized); bestFeatureStorage1.Add(bestFeatures[0]); bestFeatureStorage1.Add(bestFeatures[2]); bestFeatureStorage2.Add(bestFeatures[1]); bestFeatureStorage2.Add(bestFeatures[3]); //Calculating the transformation for the best features Transformation transformation = calculateTransformationValues(bestFeatures); //Exporting the graph Exporter exporter = new Exporter(); exporter.exportFeatures(image1_features_normalized, image2_features_normalized); return(transformation); }
public Transformation calculateTransformation(List<Contour<Point>> contours_image1, List<Contour<Point>> contours_image2) { List<Feature> image1_features = new List<Feature>(); List<Feature> image2_features = new List<Feature>(); //Get the points of the FIRST (=0) contour Point[] points1 = contours_image1[0].ToArray(); //Calculate the angle at every pixel for picture 1 for (int i = 0; i < points1.Length; i++) { AngleCalculator angleCalculator = new AngleCalculator(); double angle = angleCalculator.calculateAngle (points1, i); Feature f = new Feature(); f.point = points1[i]; f.angle_at_pixel = angle; image1_features.Add(f); } //Get the points of the FIRST (=0) contour Point[] points2 = contours_image2[0].ToArray(); //Calculate the angle at every pixel for picture 2 for (int i = 0; i < points2.Length; i++) { AngleCalculator angleCalculator = new AngleCalculator(); double angle = angleCalculator.calculateAngle(points2, i); Feature f = new Feature(); f.point = points2[i]; f.angle_at_pixel = angle; image2_features.Add(f); } GraphAnalyzer graphanalyzer = new GraphAnalyzer(); //Normalize the shorter contour to longer one List<Feature> image1_features_normalized; List<Feature> image2_features_normalized; if (image1_features.Count < image2_features.Count) { image1_features_normalized = graphanalyzer.normalize(image2_features, image1_features); image2_features_normalized = image2_features; } else { image2_features_normalized = graphanalyzer.normalize(image1_features, image2_features); image1_features_normalized = image1_features; } //Moves the contour(graph) of image1 to best matching image1_features_normalized = graphanalyzer.matchGraphs(image1_features_normalized, image2_features_normalized); //Get the best Features by using extrema [0] image1 --> [1] image2, .... List<Feature> bestFeatures = graphanalyzer.findBestFeaturesWithExtrema(image1_features_normalized, image2_features_normalized); bestFeatureStorage1.Add(bestFeatures[0]); bestFeatureStorage1.Add(bestFeatures[2]); bestFeatureStorage2.Add(bestFeatures[1]); bestFeatureStorage2.Add(bestFeatures[3]); //Calculating the transformation for the best features Transformation transformation = calculateTransformationValues(bestFeatures); //Exporting the graph Exporter exporter = new Exporter(); exporter.exportFeatures(image1_features_normalized, image2_features_normalized); return transformation; }