public void SolidIntersectPlaneTwice() { this.Name = nameof(SolidIntersectPlaneTwice); var r = new Random(); var l = Polygon.L(5, 5, 1); var profile = new Profile(l, l.Offset(-0.1).Reversed()); var arc = new Arc(Vector3.Origin, 5, 0, 180); var sweep = new Sweep(profile, arc, 0, 0, 0, false); var plane = new Plane(Vector3.Origin, Vector3.YAxis.Negate()); Assert.True(sweep.Solid.Intersects(plane, out List <Polygon> result)); Assert.Equal(4, result.Count); foreach (var p in result) { Assert.Equal(6, p.Vertices.Count); this.Model.AddElement(new Panel(p, r.NextMaterial())); } var rep = new Representation(new List <SolidOperation>() { sweep }); var solidElement = new GeometricElement(representation: rep, material: BuiltInMaterials.Mass); this.Model.AddElement(solidElement); }
protected override Character CreateCopy() { Sweep copy = new Sweep(); copy.m_state = State; return(copy); }
public void Csg() { this.Name = "Elements_Geometry_Csg"; var s1 = new Extrude(Polygon.Rectangle(Vector3.Origin, new Vector3(30, 30)), 50, Vector3.ZAxis, false); var csg = s1.Solid.ToCsg(); var s2 = new Extrude(Polygon.Rectangle(30, 30), 30, Vector3.ZAxis, false); csg = csg.Substract(s2.Solid.ToCsg()); var s3 = new Sweep(Polygon.Rectangle(Vector3.Origin, new Vector3(5, 5)), new Line(new Vector3(0, 0, 45), new Vector3(30, 0, 45)), 0, 0, false); csg = csg.Union(s3.Solid.ToCsg()); var poly = new Polygon(new List <Vector3>() { new Vector3(0, 0, 0), new Vector3(20, 50, 0), new Vector3(0, 50, 0) }); var s4 = new Sweep(poly, new Line(new Vector3(0, 30, 0), new Vector3(30, 30, 0)), 0, 0, false); csg = csg.Substract(s4.Solid.ToCsg()); var result = new Mesh(); csg.Tessellate(ref result); this.Model.AddElement(new MeshElement(result, new Material("Mod", Colors.Red, 0.5, 0.5))); }
public IActionResult Failure([FromRoute] Guid id) { if (ModelState.IsValid) { Scan scan = _context.Scans.Single(s => s.Id == id); scan.StopTime = DateTime.UtcNow; scan.Status = "Failed"; _context.Scans.Update(scan); Sweep sweep = _context.Sweeps.Single(s => s.Id == scan.SweepIdentifier); sweep.ErrorCount++; if ((sweep.CompleteCount + sweep.ErrorCount) == sweep.ScanCount) { sweep.Status = "Completed"; } _context.Sweeps.Update(sweep); _context.SaveChanges(); return(Ok()); } else { return(BadRequest(ModelState)); } }
public static Sweep Cast(VesselWrapper vsl, Vector3 dir, float angle, float dist) { var s = new Sweep(vsl); s.Cast(dir, angle, dist); return(s); }
/// <summary>Reset the component to its initial state, so that it may be reused without side effects.</summary> public override void Reset() { base.Reset(); IsSleepAllowedInternal = true; IsAwakeInternal = true; _isRotationFixed = false; IsBulletInternal = false; IslandIndex = 0; Transform = WorldTransform.Identity; Sweep = new Sweep(); LinearVelocityInternal = Vector2.Zero; AngularVelocityInternal = 0; ForceInternal = Vector2.Zero; Torque = 0; JointList = -1; ContactList = -1; MassInternal = 0; InverseMass = 0; _inertia = 0; InverseInertia = 0; LinearDampingInternal = 0; AngularDampingInternal = 0; SleepTime = 0; }
private void UpdateGeometry(Sweep sweep) { var profileTrans = new Transform(); profileTrans.Rotate(profileTrans.ZAxis, sweep.ProfileRotation); sweep._solid = Kernel.Instance.CreateSweepAlongCurve(profileTrans.OfProfile(sweep.Profile), sweep.Curve, sweep.StartSetback, sweep.EndSetback); }
public void Difference() { this.Name = "CSG_Difference"; var profile = _profileFactory.GetProfileByType(HSSPipeProfileType.HSS10_000x0_188); var path = new Arc(Vector3.Origin, 5, 0, 270); var s1 = new Sweep(profile, path, 0, 0, 0, true); var csg = s1.Solid.ToCsg(); var s2 = new Extrude(new Circle(Vector3.Origin, 6).ToPolygon(20), 1, Vector3.ZAxis, false); csg = csg.Substract(s2.Solid.ToCsg()); for (var i = 0.0; i < 1.0; i += 0.05) { var pt = path.PointAt(i); var hole = new Extrude(new Circle(Vector3.Origin, 0.05).ToPolygon(), 3, Vector3.ZAxis, false); csg = csg.Substract(hole.Solid.ToCsg().Transform(new Transform(pt + new Vector3(0, 0, -2)).ToMatrix4x4())); } var result = new Mesh(); csg.Tessellate(ref result); var me2 = new MeshElement(result); this.Model.AddElement(me2); }
public Radar(ModuleTCA tca) : base(tca) { CurHit = new Sweep(VSL); BestHit = new Sweep(VSL); DetectedHit = new Sweep(VSL); Altimeter = new PQS_Altimeter(VSL); }
public void Tunnel() { this.Name = "Topography_Tunnel"; var topo = CreateTopoFromMapboxElevations(); var csg = topo.Mesh.ToCsg(); var w = topo.RowWidth * topo.CellWidth; var tunnelPath = new Line(new Vector3((-w - 100) / 2, 0, -20), new Vector3((w + 100) / 2, 0, -20)); var tunnel = new Sweep(new Circle(Vector3.Origin, 20).ToPolygon(20), tunnelPath, 0, 0, 0, false); var tunnelTransform = new Transform(topo.Mesh.Vertices[topo.RowWidth * topo.RowWidth / 2 + topo.RowWidth / 2].Position + new Vector3(0, 0, -50)); csg = csg.Substract(tunnel._csg.Transform(tunnelTransform.ToMatrix4x4())); var result = new Mesh(); csg.Tessellate(ref result); result.ComputeNormals(); topo.Mesh = result; this.Model.AddElement(topo); var tunnelWalls = new Beam(tunnelPath, new Profile(new Circle(Vector3.Origin, 20).ToPolygon(20), new Circle(Vector3.Origin, 19).ToPolygon(20).Reversed()), transform: tunnelTransform); this.Model.AddElement(tunnelWalls); }
private void Activate(ExciterOperationMode value) { operation_ = value; switch (operation_) { case ExciterOperationMode.Barrage: Barrage.Activate(); break; case ExciterOperationMode.MultiSpot: MultiSpot.Activate(); break; case ExciterOperationMode.Spot: Spot.Activate(); break; case ExciterOperationMode.Sweep: Sweep.Activate(); break; case ExciterOperationMode.Comb: Comb.Activate(); break; } }
private static IfcSurfaceCurveSweptAreaSolid ToIfcSurfaceCurveSweptAreaSolid(this Sweep sweep, Document doc) { var position = new Transform().ToIfcAxis2Placement3D(doc); var sweptArea = sweep.Profile.Perimeter.ToIfcArbitraryClosedProfileDef(doc); var directrix = sweep.Curve.ToIfcCurve(doc); var profile = new IfcArbitraryOpenProfileDef(IfcProfileTypeEnum.CURVE, directrix); var extrudeDir = Vector3.ZAxis.ToIfcDirection(); var extrudeSurfPosition = new Transform(0, 0, -100).ToIfcAxis2Placement3D(doc); doc.AddEntity(extrudeSurfPosition); var surface = new IfcSurfaceOfLinearExtrusion(profile, position, extrudeDir, 100); // You must use the version of this constructor that has position, startParam, // and endParam. If you don't, ArchiCAD (and possibly others) will call // the geometry invalid. var solid = new IfcSurfaceCurveSweptAreaSolid(sweptArea, position, directrix, 0, 1, surface); doc.AddEntity(position); doc.AddEntity(sweptArea); doc.AddEntity(directrix); doc.AddEntity(extrudeDir); doc.AddEntity(profile); doc.AddEntity(surface); doc.AddEntity(solid); return(solid); }
public void Sweep() { // From issue #447 Sweep sweep = new Sweep(); sweep.LocalCenter.SetZero(); sweep.C0.Set(-2.0f, 4.0f); sweep.C.Set(3.0f, 8.0f); sweep.A0 = 0.5f; sweep.A = 5.0f; sweep.Alpha0 = 0.0f; Transform transform; sweep.GetTransform(out transform, 0.0f); transform.Position.X.ShouldBe(sweep.C0.X); transform.Position.Y.ShouldBe(sweep.C0.Y); transform.Rotation.Cos.ShouldBe((float)Math.Cos(sweep.A0)); transform.Rotation.Sin.ShouldBe((float)Math.Sin(sweep.A0)); sweep.GetTransform(out transform, 1.0f); transform.Position.X.ShouldBe(sweep.C.X); transform.Position.Y.ShouldBe(sweep.C.Y); transform.Rotation.Cos.ShouldBe((float)Math.Cos(sweep.A)); transform.Rotation.Sin.ShouldBe((float)Math.Sin(sweep.A)); }
/// <summary> /// Решает краевую задачу с заданными параметрами /// </summary> /// <param name="input">Структура, представляющая входные параметры</param> /// <param name="count">Количество значений</param> public static double[] GetBoundaryValue(BoundaryInput input, int count) { var boundaryMatrix = GetBoundaryMatrix(input, count); var outputArray = Sweep.SweepMatrix(boundaryMatrix); return(outputArray); }
private int sweep() { var multi = getAttackMultiplier(); var increase = getAttackModifier(); var sweep = new Sweep(); return(sweep.Action(Strength - 15, 0, multi, increase)); }
public async Task <ActionResult> DeleteConfirmed(int id) { Sweep sweep = await db.Sweeps.FindAsync(id); db.Sweeps.Remove(sweep); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public Sweep set(Sweep argCloneFrom) { localCenter.set(argCloneFrom.localCenter); c0.set(argCloneFrom.c0); c.set(argCloneFrom.c); a0 = argCloneFrom.a0; a = argCloneFrom.a; return(this); }
private int sweep() { var increase = getAttackModifier(); var multi = getAttackMultiplier(); var sweep = new Sweep(); Cooldowns[2] = sweep.Cooldown; return(sweep.Action(Strength, Crit, multi, increase)); }
internal override float ComputeTOI(ref Sweep sweepA, ref Sweep sweepB) { TOIInput input; input.sweepA = sweepA; input.sweepB = sweepB; input.tolerance = Settings.b2_linearSlop; return TimeOfImpact.CalculateTimeOfImpact(ref input, (PolygonShape)_fixtureA.GetShape(), (CircleShape)_fixtureB.GetShape()); }
public void Copy(Sweep s) { VSL = s.VSL; L = s.L; C = s.C; R = s.R; Obstacle = s.Obstacle; Altitude = s.Altitude; Maneuver = s.Maneuver; Valid = s.Valid; }
internal override void Trigger() { base.Trigger(); _currentFrequencyPeriod = FrequencyPeriod; _lastOutput = 0; Envelope.Trigger(); Sweep.Trigger(FrequencyPeriod); Device.Log.Information("Triggering sound 1 with frequency {0}Hz period {1}, envelope ({2}), sweep ({3})", ActualFrequencyHz, FrequencyPeriod, Envelope, Sweep); }
public void Save(Body body) { Force = body.Force; Torque = body.Torque; Xf = body.Xf; Sweep = body.Sweep; LinearVelocity = body.LinearVelocity; AngularVelocity = body.AngularVelocity; Awake = body.Awake; }
public async Task <ActionResult> Edit([Bind(Include = "SweepID,Name,Description,StartDate,EndDate")] Sweep sweep) { if (ModelState.IsValid) { db.Entry(sweep).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(sweep)); }
public float ComputeTOI(Sweep sweepA, Sweep sweepB) { Collision.Collision.TOIInput input = new Collision.Collision.TOIInput(); input.ProxyA.Set(_fixtureA.GetShape()); input.ProxyB.Set(_fixtureB.GetShape()); input.SweepA = sweepA; input.SweepB = sweepB; input.Tolerance = Settings.LinearSlop; return(Collision.Collision.TimeOfImpact(input)); }
public void Clone(TOIInput input) { this.ProxyA.Radius = input.ProxyA.Radius; this.ProxyA.Vertices.Clear(); this.ProxyA.Vertices.AddRange(input.ProxyA.Vertices); this.ProxyB.Radius = input.ProxyB.Radius; this.ProxyB.Vertices.Clear(); this.ProxyB.Vertices.AddRange(input.ProxyB.Vertices); this.SweepA = input.SweepA; this.SweepB = input.SweepB; this.TMax = input.TMax; }
public float ComputeTOI(Sweep sweepA, Sweep sweepB) { TOIInput input = new TOIInput(); input.SweepA = sweepA; input.SweepB = sweepB; input.SweepRadiusA = _fixtureA.ComputeSweepRadius(sweepA.LocalCenter); input.SweepRadiusB = _fixtureB.ComputeSweepRadius(sweepB.LocalCenter); input.Tolerance = Common.Settings.LinearSlop; return(Collision.Collision.TimeOfImpact(input, _fixtureA.Shape, _fixtureB.Shape)); }
public async Task <ActionResult> Create([Bind(Include = "SweepID,Name,Description,StartDate,EndDate")] Sweep sweep) { if (ModelState.IsValid) { db.Sweeps.Add(sweep); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(sweep)); }
public override void Step(Settings settings) { settings.pause = 1; base.Step(settings); settings.pause = 0; Sweep sweep1 = new Sweep(); sweep1.C0.Set(0.0f, 20.0f); sweep1.A0 = 0.0f; sweep1.C = sweep1.C0; sweep1.A = sweep1.A0; sweep1.T0 = 0.0f; sweep1.LocalCenter = _body1.GetLocalCenter(); Sweep sweep2 = new Sweep(); sweep2.C0.Set(9.6363468f, 28.050615f); sweep2.A0 = 1.6408679f; sweep2.C = sweep2.C0 + new Vec2(-0.075121880f, 0.27358246f); sweep2.A = sweep2.A0 - 10.434675f; sweep2.T0 = 0.0f; sweep2.LocalCenter = _body2.GetLocalCenter(); TOIInput input = new TOIInput { SweepA = sweep1, SweepB = sweep2 }; float toi = Collision.TimeOfImpact(input, _shape1, _shape2); OpenGLDebugDraw.DrawString(5, _textLine, "toi = " + toi.ToString()); _textLine += 15; XForm xf2 = new XForm(); sweep2.GetTransform(out xf2, toi); int vertexCount = _shape2.VertexCount; Vec2[] vertices = new Vec2[Box2DNet.Common.Settings.MaxPolygonVertices]; Vec2[] localVertices = _shape2.Vertices; for (int i = 0; i < vertexCount; ++i) { vertices[i] = Box2DNet.Common.Math.Mul(xf2, localVertices[i]); } _debugDraw.DrawPolygon(vertices, vertexCount, new Color(0.5f, 0.7f, 0.9f)); localVertices = _shape2.CoreVertices; for (int i = 0; i < vertexCount; ++i) { vertices[i] = Box2DNet.Common.Math.Mul(xf2, localVertices[i]); } _debugDraw.DrawPolygon(vertices, vertexCount, new Color(0.5f, 0.7f, 0.9f)); }
// GET: Sweeps/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Sweep sweep = await db.Sweeps.FindAsync(id); if (sweep == null) { return(HttpNotFound()); } return(View(sweep)); }
public void UpdateSweep(Sweep sweep) { JsonObject obj = BuildGameMessageJson(GameMessageType.SweepUpdated, msg => { var bounds = sweep.Bounds; msg.start = new JsonObject(); msg.start.x = bounds.Item1.X; msg.start.y = bounds.Item1.Y; msg.end = new JsonObject(); msg.end.x = bounds.Item2.X; msg.end.y = bounds.Item2.Y; }); Messages.Add(obj); }
public static List <Sweep> GenerateCandidates(IHostEnvironment env, string dataFile, string schemaDefinitionFile) { var patterns = new List <Sweep>(); string loaderSettings; Type predictorType; TransformInference.InferenceResult inferenceResult; // Get the initial recipes for this data. RecipeInference.SuggestedRecipe[] recipes = RecipeInference.InferRecipesFromData(env, dataFile, schemaDefinitionFile, out predictorType, out loaderSettings, out inferenceResult); //get all the trainers for this task, and generate the initial set of candidates. // Exclude the hidden learners, and the metalinear learners. var trainers = env.ComponentCatalog.GetAllDerivedClasses(typeof(ITrainer), predictorType).Where(cls => !cls.IsHidden); if (!string.IsNullOrEmpty(loaderSettings)) { StringBuilder sb = new StringBuilder(); CmdQuoter.QuoteValue(loaderSettings, sb, true); loaderSettings = sb.ToString(); } string loader = $" loader=TextLoader{loaderSettings}"; // REVIEW: there are more learners than recipes atm. // Flip looping through recipes, then through learners if the cardinality changes. foreach (ComponentCatalog.LoadableClassInfo cl in trainers) { string learnerSettings; TrainerSweeper trainerSweeper = new TrainerSweeper(); trainerSweeper.Parameters.AddRange(RecipeInference.GetLearnerSettingsAndSweepParams(env, cl, out learnerSettings)); foreach (var recipe in recipes) { RecipeInference.SuggestedRecipe.SuggestedLearner learner = new RecipeInference.SuggestedRecipe.SuggestedLearner { LoadableClassInfo = cl, Settings = learnerSettings }; Pattern pattern = new Pattern(recipe.Transforms, learner, loader); Sweep sweep = new Sweep(pattern, trainerSweeper); patterns.Add(sweep); } } return(patterns); }
public void Execute(UpdaterData data) { Document doc = data.GetDocument(); if (doc.IsFamilyDocument) { try { //Get document Name string name = doc.Title; string n2 = "null"; if (String.IsNullOrEmpty(name)) { name = "null"; } //Get form location info (Varies by type?) foreach (ElementId e in data.GetModifiedElementIds()) { GenericForm ele = doc.GetElement(e) as GenericForm; if (ele != null) { Sweep sweep = doc.GetElement(e) as Sweep; if (sweep != null) { if (sweep.ProfileSymbol != null) { n2 = sweep.ProfileSymbol.Profile.Name; } } var bbox = ele.get_BoundingBox(null); if (bbox != null) { var dims = GetDims(bbox); if (Enum.GetNames(typeof(ObjectCategory)).ToList().Any(x => ele.Subcategory.Name.Contains(x))) { int Correct = Enum.GetNames(typeof(ObjectCategory)).ToList().IndexOf(Enum.GetNames(typeof(ObjectCategory)).ToList().Where(x => ele.Subcategory.Name.Contains(x)).First()); Datatype.ObjectStyle.PropogateSingle(Correct, new WriteToCMDLine(WriteNull), name, n2, dims); } } } } } catch (Exception e) { e.OutputError(); } } }
public static void Set(ref SimplexCache cache, DistanceProxy proxyA, ref Sweep sweepA, DistanceProxy proxyB, ref Sweep sweepB, float t1) { _localPoint = Vector2.Zero; _proxyA = proxyA; _proxyB = proxyB; int count = cache.Count; Debug.Assert(0 < count && count < 3); _sweepA = sweepA; _sweepB = sweepB; Transform xfA, xfB; _sweepA.GetTransform(out xfA, t1); _sweepB.GetTransform(out xfB, t1); if (count == 1) { _type = SeparationFunctionType.Points; Vector2 localPointA = _proxyA.Vertices[cache.IndexA[0]]; Vector2 localPointB = _proxyB.Vertices[cache.IndexB[0]]; Vector2 pointA = MathUtils.Multiply(ref xfA, localPointA); Vector2 pointB = MathUtils.Multiply(ref xfB, localPointB); _axis = pointB - pointA; _axis.Normalize(); return; } else if (cache.IndexA[0] == cache.IndexA[1]) { // Two points on B and one on A. _type = SeparationFunctionType.FaceB; Vector2 localPointB1 = proxyB.Vertices[cache.IndexB[0]]; Vector2 localPointB2 = proxyB.Vertices[cache.IndexB[1]]; Vector2 a = localPointB2 - localPointB1; _axis = new Vector2(a.Y, -a.X); _axis.Normalize(); Vector2 normal = MathUtils.Multiply(ref xfB.R, _axis); _localPoint = 0.5f * (localPointB1 + localPointB2); Vector2 pointB = MathUtils.Multiply(ref xfB, _localPoint); Vector2 localPointA = proxyA.Vertices[cache.IndexA[0]]; Vector2 pointA = MathUtils.Multiply(ref xfA, localPointA); float s = Vector2.Dot(pointA - pointB, normal); if (s < 0.0f) { _axis = -_axis; s = -s; } return; } else { // Two points on A and one or two points on B. _type = SeparationFunctionType.FaceA; Vector2 localPointA1 = _proxyA.Vertices[cache.IndexA[0]]; Vector2 localPointA2 = _proxyA.Vertices[cache.IndexA[1]]; Vector2 a = localPointA2 - localPointA1; _axis = new Vector2(a.Y, -a.X); _axis.Normalize(); Vector2 normal = MathUtils.Multiply(ref xfA.R, _axis); _localPoint = 0.5f * (localPointA1 + localPointA2); Vector2 pointA = MathUtils.Multiply(ref xfA, _localPoint); Vector2 localPointB = _proxyB.Vertices[cache.IndexB[0]]; Vector2 pointB = MathUtils.Multiply(ref xfB, localPointB); float s = Vector2.Dot(pointB - pointA, normal); if (s < 0.0f) { _axis = -_axis; s = -s; } return; } }
public override void Update(GameSettings settings, GameTime gameTime) { base.Update(settings, gameTime); Sweep sweepA = new Sweep(); sweepA.C0 = new Vector2(24.0f, -60.0f); sweepA.A0 = 2.95f; sweepA.C = sweepA.C0; sweepA.A = sweepA.A0; sweepA.LocalCenter = Vector2.Zero; Sweep sweepB = new Sweep(); sweepB.C0 = new Vector2(53.474274f, -50.252514f); sweepB.A0 = 513.36676f; // - 162.0f * b2_pi; sweepB.C = new Vector2(54.595478f, -51.083473f); sweepB.A = 513.62781f; // - 162.0f * b2_pi; sweepB.LocalCenter = Vector2.Zero; //sweepB.a0 -= 300.0f * b2_pi; //sweepB.a -= 300.0f * b2_pi; TOIInput input = new TOIInput(); input.ProxyA.Set(_shapeA, 0); input.ProxyB.Set(_shapeB, 0); input.SweepA = sweepA; input.SweepB = sweepB; input.TMax = 1.0f; TOIOutput output; TimeOfImpact.CalculateTimeOfImpact(out output, input); DrawString("TOI = " + output.T); DrawString(string.Format("Max TOI iters = {0:n}, Max root iters = {1:n}", TimeOfImpact.TOIMaxIters, TimeOfImpact.TOIMaxRootIters)); Vector2[] vertices = new Vector2[Settings.MaxPolygonVertices]; DebugView.BeginCustomDraw(ref GameInstance.Projection, ref GameInstance.View); Transform transformA; sweepA.GetTransform(out transformA, 0.0f); for (int i = 0; i < _shapeA.Vertices.Count; ++i) { vertices[i] = MathUtils.Mul(ref transformA, _shapeA.Vertices[i]); } DebugView.DrawPolygon(vertices, _shapeA.Vertices.Count, new Color(0.9f, 0.9f, 0.9f)); Transform transformB; sweepB.GetTransform(out transformB, 0.0f); for (int i = 0; i < _shapeB.Vertices.Count; ++i) { vertices[i] = MathUtils.Mul(ref transformB, _shapeB.Vertices[i]); } DebugView.DrawPolygon(vertices, _shapeB.Vertices.Count, new Color(0.5f, 0.9f, 0.5f)); sweepB.GetTransform(out transformB, output.T); for (int i = 0; i < _shapeB.Vertices.Count; ++i) { vertices[i] = MathUtils.Mul(ref transformB, _shapeB.Vertices[i]); } DebugView.DrawPolygon(vertices, _shapeB.Vertices.Count, new Color(0.5f, 0.7f, 0.9f)); sweepB.GetTransform(out transformB, 1.0f); for (int i = 0; i < _shapeB.Vertices.Count; ++i) { vertices[i] = MathUtils.Mul(ref transformB, _shapeB.Vertices[i]); } DebugView.DrawPolygon(vertices, _shapeB.Vertices.Count, new Color(0.9f, 0.5f, 0.5f)); DebugView.EndCustomDraw(); }
public static Sweep Cast(VesselWrapper vsl, Vector3 dir, float angle, float dist) { var s = new Sweep(vsl); s.Cast(dir, angle, dist); return s; }
private void Stream( ArrayList data, Sweep sweep ) { data.Add( new Snoop.Data.ClassSeparator( typeof( Sweep ) ) ); data.Add( new Snoop.Data.Bool( "Is trajectory segmentation enabled", sweep.IsTrajectorySegmentationEnabled ) ); data.Add( new Snoop.Data.Angle( "Max segment angle", sweep.MaxSegmentAngle ) ); data.Add( new Snoop.Data.Object( "Path 3D", sweep.Path3d ) ); data.Add( new Snoop.Data.Object( "Path sketch", sweep.PathSketch ) ); data.Add( new Snoop.Data.Object( "Profile sketch", sweep.ProfileSketch ) ); data.Add( new Snoop.Data.Object( "Profile symbol", sweep.ProfileSymbol ) ); }
public override void Step(Framework.Settings settings) { base.Step(settings); Sweep sweepA = new Sweep(); sweepA.c0 = new Vector2(24.0f, -60.0f); sweepA.a0 = 2.95f; sweepA.c = sweepA.c0; sweepA.a = sweepA.a0; sweepA.localCenter = Vector2.Zero; Sweep sweepB = new Sweep(); sweepB.c0 = new Vector2(53.474274f, -50.252514f); sweepB.a0 = 513.36676f; sweepB.c = new Vector2(54.595478f, -51.083473f); sweepB.a = 513.62781f; sweepB.localCenter = Vector2.Zero; TOIInput input = new TOIInput(); input.proxyA.Set(_shapeA, 0); input.proxyB.Set(_shapeB, 0); input.sweepA = sweepA; input.sweepB = sweepB; input.tMax = 1.0f; TOIOutput output; XNA.TimeOfImpact.CalculateTimeOfImpact(out output, ref input); _debugDraw.DrawString(50, _textLine, "toi = {0:n}", output.t); _textLine += 15; _debugDraw.DrawString(50, _textLine, "max toi iters = {0:n}, max root iters = {1:n}", XNA.TimeOfImpact.b2_toiMaxIters, XNA.TimeOfImpact.b2_toiMaxRootIters); _textLine += 15; FixedArray8<Vector2> vertices = new FixedArray8<Vector2>(); Transform transformA; sweepA.GetTransform(out transformA, 0.0f); for (int i = 0; i < _shapeA._vertexCount; ++i) { vertices[i] = MathUtils.Multiply(ref transformA, _shapeA._vertices[i]); } _debugDraw.DrawPolygon(ref vertices, _shapeA._vertexCount, new Color(0.9f, 0.9f, 0.9f)); Transform transformB; sweepB.GetTransform(out transformB, 0.0f); Vector2 localPoint = new Vector2(2.0f, -0.1f); Vector2 rB = MathUtils.Multiply(ref transformB, localPoint) - sweepB.c0; float wB = sweepB.a - sweepB.a0; Vector2 vB = sweepB.c - sweepB.c0; Vector2 v = vB + MathUtils.Cross(wB, rB); for (int i = 0; i < _shapeB._vertexCount; ++i) { vertices[i] = MathUtils.Multiply(ref transformB, _shapeB._vertices[i]); } _debugDraw.DrawPolygon(ref vertices, _shapeB._vertexCount, new Color(0.5f, 0.9f, 0.5f)); sweepB.GetTransform(out transformB, output.t); for (int i = 0; i < _shapeB._vertexCount; ++i) { vertices[i] = MathUtils.Multiply(ref transformB, _shapeB._vertices[i]); } _debugDraw.DrawPolygon(ref vertices, _shapeB._vertexCount, new Color(0.5f, 0.7f, 0.9f)); sweepB.GetTransform(out transformB, 1.0f); for (int i = 0; i < _shapeB._vertexCount; ++i) { vertices[i] = MathUtils.Multiply(ref transformB, _shapeB._vertices[i]); } _debugDraw.DrawPolygon(ref vertices, _shapeB._vertexCount, new Color(0.9f, 0.5f, 0.5f)); }