public Bitmap ToJitter(Bitmap Im) { AForge.Imaging.Filters.Jitter Img = new Jitter(); Bitmap bmImage = AForge.Imaging.Image.Clone(new Bitmap(Im), PixelFormat.Format24bppRgb); return(Img.Apply(bmImage)); }
/// <summary> /// Create a new retry configuration. /// </summary> /// <param name="baseDelayMs">The base delay (milliseconds) used to calculate the time before making another request attempt.</param> /// <param name="maxRetries">The maximum number of attempts to make before cancelling the request task.</param> /// <param name="listener">A callback that is invoked before a new retry attempt is made.</param> /// <param name="jitter">/// The jitter algorithm used to apply randomness to the retry delay.</param> public RetryConfiguration(int baseDelayMs, int maxRetries, RetryListener listener, Jitter jitter) { BaseDelayMs = baseDelayMs; RetryListener = listener; MaxAttempts = maxRetries; Jitter = jitter; }
public void Updates_Settings_Property() { // act Jitter.UpdateSettings(new JitterSettings(percentage: 35)); Assert.Equal(35, Jitter.Settings.Percentage); }
public void Returns_A_Number_Within_Percentage_Below_And_Above_Number() { // act var result = Jitter.Apply(100d, new JitterSettings(percentage: 25)); Assert.InRange(result, 75d, 125d); }
public void Ex(TimelineHandler handler) { foreach (var timelineEvent in handler.TimeLineEvents) { WorkingHours.Is(handler); if (timelineEvent.DelayBefore > 0) { Thread.Sleep(timelineEvent.DelayBefore); } _log.Trace($"Click: {timelineEvent.Command} with delay after of {timelineEvent.DelayAfter}"); switch (timelineEvent.Command) { default: //Call the imported function with the cursor's current position var x = Cursor.Position.X; var y = Cursor.Position.Y; DoLeftMouseClick(x, y); _log.Trace($"Click: {x}:{y}"); Thread.Sleep(Jitter.Randomize(timelineEvent.CommandArgs[0], timelineEvent.CommandArgs[1], timelineEvent.CommandArgs[2])); this.Report(handler.HandlerType.ToString(), timelineEvent.Command, "", timelineEvent.TrackableId, $"{x}:{y}"); break; } if (timelineEvent.DelayAfter > 0) { Thread.Sleep(timelineEvent.DelayAfter); } } }
private void Jitter_Filter_Process() { var filter = new Jitter(4); AddLog("filtr Jitter na " + _view.CurrentFile); filter.ApplyInPlace(_image); Thread.Sleep(200); }
internal CharacterController(Jitter.World world, RigidBody body) : base(body) { RigidBody.SetMassProperties(JMatrix.Zero, 1.0f, true); RigidBody.AllowDeactivation = false; Controller = new Character.CharacterControllerConstraint(world, RigidBody); world.AddConstraint(Controller); }
public static Bitmap Jitter(Bitmap bmp, int value) { // create filter Jitter filter = new Jitter(value); // apply the filter filter.ApplyInPlace(bmp); return(bmp); }
private void Jitter_Filter_Process(object callback) { var filter = new Jitter(4); AddLog("filtr Jitter na " + _view.CurrentFile); filter.ApplyInPlace(_image); Thread.Sleep(200); ((AutoResetEvent)callback).Set(); }
public mEffectJitter(int radius) { BitmapType = mFilter.BitmapTypes.None; Radius = radius; Effect = new Jitter(); Effect.Radius = Radius; filter = Effect; }
/// <summary> /// Constructor that specifies all available settings /// </summary> /// <param name="maxRetries"></param> /// <param name="delayMilliseconds"></param> /// <param name="maxDelayMilliseconds"></param> /// <param name="jitter"></param> /// <param name="exceptionHandlingLogic"></param> public ExponentialBackoffAndRetryConfig( int maxRetries, int delayMilliseconds, int maxDelayMilliseconds, Jitter jitter, Func <Exception, bool> exceptionHandlingLogic) { this.MaximumRetries = maxRetries; this.DelayInMilliseconds = delayMilliseconds; this.MaxBackoffInMilliseconds = maxDelayMilliseconds; this.Jitter = jitter; this.ExceptionHandlingLogic = exceptionHandlingLogic; }
private Point[] Gen() { var points = new List <Point>(); for (var v = 0; v < VSteps; v++) { for (var u = 0; u < USteps; u++) { points.Add(Corner + U * (u + Jitter.Next()) + V * (v + Jitter.Next())); } } return(points.ToArray()); }
public Player(Jitter.World World) { this.Position = new Vector(0.0, 0.0, 0.0); this._Body = new RigidBody(new BoxShape(0.5f, 1.7f, 0.5f)); //this._Body.UseUserMassProperties(new JMatrix(), 1.0f); this._Body.Restitution = 0.0f; this._Body.Position = new Vector(0.0, 0.0, 0.0); //this._Controller = new CharacterController(World, this._Body); //this._Controller.Position = new Vector(0.0, 0.0, 10.0); this._Phys = new PhysicsComponent(this._Body); //World.AddConstraint(this._Controller); }
public CharacterControllerConstraint(Jitter.World world, RigidBody body) : base(body, null) { World = world; // Determine feet position // This is done by supportmapping in the down direction // furthest point away from the down direction. JVector vec = JVector.Down; JVector result = JVector.Zero; body.Shape.SupportMapping(ref vec, out result); FeetPosition = result * JVector.Down; }
/// <summary> /// Default constructor that sets MaximumRetries = 50, /// DelayInMilliseconds = 200, /// MaxBackoffInMilliseconds = 2000, /// Jitter = Jitter.FULL, /// and ExceptionHandlingLogic to retry on TimeoutException, HttpRequestException, /// and OperationCanceledException /// </summary> public ExponentialBackoffAndRetryConfig() { this.MaximumRetries = 50; this.DelayInMilliseconds = 200; this.MaxBackoffInMilliseconds = 2000; this.Jitter = Jitter.FULL; this.ExceptionHandlingLogic = (ex) => { if (ex is TimeoutException || ex is HttpRequestException || ex is OperationCanceledException || ex is HttpResponseException) { return(true); } else { return(false); } }; }
public CharacterController(Jitter.World world, Jitter.Dynamics.RigidBody body) : base(body, null) { this.World = world; // determine the position of the feets of the character // this can be done by supportmapping in the down direction. // (furthest point away in the down direction) JVector vec = JVector.Down; JVector result = JVector.Zero; // Note: the following works just for normal shapes, for multishapes (compound for example) // you have to loop through all sub-shapes -> easy. body.Shape.SupportMapping(ref vec, out result); // feet position is now the distance between body.Position and the feets // Note: the following '*' is the dot product. feetPosition = result * JVector.Down; }
/// <summary> /// Run background polling for remote config changes /// </summary> private void LoadRemoteConfigAfterInterval() { cancellationTokenSource = new CancellationTokenSource(); var token = cancellationTokenSource.Token; Task.Factory.StartNew(async() => { while (!token.IsCancellationRequested) { // wait for an interval with jitter var interval = Jitter.Apply(pollingIntervalInMillisecond); log.DebugFormat("Loading configuration from {0} in {1}ms", configurationFileUrl, interval); await Task.Delay(interval, token).ConfigureAwait(false); await LoadRemoteConfig().ConfigureAwait(false); } }, token, TaskCreationOptions.LongRunning, TaskScheduler.Default); }
public void DrawTriangle(Jitter.LinearMath.JVector pos1, Jitter.LinearMath.JVector pos2, Jitter.LinearMath.JVector pos3) { var n = Jitter.LinearMath.JVector.Cross(pos2 - pos1, pos3 - pos1); Batch.AddVector3(pos1.X, pos1.Y, pos1.Z); Batch.AddVector3(ref Color); Batch.AddVector3(n.X, n.Y, n.Z); Batch.AddVector3(pos2.X, pos2.Y, pos2.Z); Batch.AddVector3(ref Color); Batch.AddVector3(n.X, n.Y, n.Z); Batch.AddVector3(pos3.X, pos3.Y, pos3.Z); Batch.AddVector3(ref Color); Batch.AddVector3(n.X, n.Y, n.Z); if (!ClockWise) Batch.AddTriangle(TriangleIndex + 0, TriangleIndex + 1, TriangleIndex + 2); else Batch.AddTriangle(TriangleIndex + 0, TriangleIndex + 2, TriangleIndex + 1); TriangleIndex += 3; }
public static Matrix ToXNAMatrix(Jitter.LinearMath.JMatrix matrix) { return new Matrix(matrix.M11, matrix.M12, matrix.M13, 0.0f, matrix.M21, matrix.M22, matrix.M23, 0.0f, matrix.M31, matrix.M32, matrix.M33, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object can be used to retrieve data from input parameters and /// to store data in output parameters.</param> protected override void SolveInstance(IGH_DataAccess DA) { Bitmap sourceImage = null; DA.GetData(0, ref sourceImage); string filter = ""; DA.GetData(1, ref filter); sourceImage = ImageUtilities.convert(sourceImage, System.Drawing.Imaging.PixelFormat.Format32bppArgb); IFilter myFilter; Bitmap filteredImage = sourceImage; //Grayscale.CommonAlgorithms.Y.Apply switch (filter) { case "Greyscale": Console.Write("Applying: " + filter); sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); filteredImage = sourceImage; break; case "Sepia": Console.Write("Applying: " + filter); myFilter = new Sepia(); filteredImage = myFilter.Apply(sourceImage); break; case "Invert": Console.Write("Applying: " + filter); sourceImage = ImageUtilities.convert(sourceImage, System.Drawing.Imaging.PixelFormat.Format24bppRgb); myFilter = new Invert(); filteredImage = myFilter.Apply(sourceImage); break; case "RotateChannel": Console.Write("Applying: " + filter); myFilter = new RotateChannels(); filteredImage = myFilter.Apply(sourceImage); break; case "Threshold": //Need Extended Version Console.Write("Applying: " + filter); sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new Threshold(); filteredImage = myFilter.Apply(sourceImage); break; case "FloydFilter": Console.Write("Applying: " + filter); //sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); //myFilter = new FloydSteinbergColorDithering(); FloydSteinbergColorDithering myReduction = new FloydSteinbergColorDithering(); filteredImage = myReduction.Apply(sourceImage); //filteredImage = myFilter.Apply(sourceImage); break; case "OrderedDithering": Console.Write("Applying: " + filter); sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new OrderedDithering(); filteredImage = myFilter.Apply(sourceImage); break; case "Sharpen": Console.Write("Applying: " + filter); myFilter = new Sharpen(); filteredImage = myFilter.Apply(sourceImage); break; case "DifferenceEdgeDetector": Console.Write("Applying: " + filter); sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new DifferenceEdgeDetector(); filteredImage = myFilter.Apply(sourceImage); break; case "HomogenityEdgeDetector": Console.Write("Applying: " + filter); sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new HomogenityEdgeDetector(); filteredImage = myFilter.Apply(sourceImage); break; case "Sobel": Console.Write("Applying: " + filter); sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new SobelEdgeDetector(); filteredImage = myFilter.Apply(sourceImage); break; case "Jitter": Console.Write("Applying: " + filter); myFilter = new Jitter(); //Needs Expand filteredImage = myFilter.Apply(sourceImage); break; case "OilPainting": Console.Write("Applying: " + filter); myFilter = new OilPainting(); //Needs Expand filteredImage = myFilter.Apply(sourceImage); break; case "TextureFiltering": Console.Write("Applying: " + filter); sourceImage = ImageUtilities.convert(sourceImage, System.Drawing.Imaging.PixelFormat.Format24bppRgb); myFilter = new Texturer(new TextileTexture(), 1.0, 0.8); //Needs Expand filteredImage = myFilter.Apply(sourceImage); break; case "Median": Console.Write("Applying: " + filter); myFilter = new Median(); filteredImage = myFilter.Apply(sourceImage); break; case "Mean": Console.Write("Applying: " + filter); myFilter = new Mean(); filteredImage = myFilter.Apply(sourceImage); break; case "Blur": //Need Extended Version Console.Write("Applying: " + filter); myFilter = new GaussianBlur(); filteredImage = myFilter.Apply(sourceImage); break; default: Console.Write("No Filter"); break; } Console.Write(filteredImage.PixelFormat.ToString()); Console.Write(sourceImage.PixelFormat.ToString()); filteredImage = ImageUtilities.convert(filteredImage, System.Drawing.Imaging.PixelFormat.Format32bppArgb); DA.SetData(0, filteredImage); }
public static Bitmap FilterImage(Bitmap img, int filter) { Bitmap sourceImage = img; sourceImage = ImageUtil.convert(sourceImage, System.Drawing.Imaging.PixelFormat.Format32bppArgb); IFilter myFilter; Bitmap filteredImage = sourceImage; if (filter == Filters.filters["Greyscale"]) { sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); filteredImage = sourceImage; } else if (filter == Filters.filters["Sepia"]) { myFilter = new Sepia(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["Invert"]) { sourceImage = ImageUtil.convert(sourceImage, System.Drawing.Imaging.PixelFormat.Format24bppRgb); myFilter = new Invert(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["RotateChannel"]) { myFilter = new RotateChannels(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["Threshold"]) { sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new Threshold(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["FloydFilter"]) { FloydSteinbergColorDithering myReduction = new FloydSteinbergColorDithering(); filteredImage = myReduction.Apply(sourceImage); } else if (filter == Filters.filters["OrderedDithering"]) { sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new OrderedDithering(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["Sharpen"]) { myFilter = new Sharpen(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["DifferenceEdgeDetector"]) { sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new DifferenceEdgeDetector(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["HomogenityEdgeDetector"]) { sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new HomogenityEdgeDetector(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["Sobel"]) { sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new SobelEdgeDetector(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["Jitter"]) { myFilter = new Jitter(); //Needs Expand filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["OilPainting"]) { sourceImage = ImageUtil.convert(sourceImage, System.Drawing.Imaging.PixelFormat.Format24bppRgb); myFilter = new OilPainting(); //Needs Expand filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["TextureFiltering"]) { sourceImage = ImageUtil.convert(sourceImage, System.Drawing.Imaging.PixelFormat.Format24bppRgb); myFilter = new Texturer(new TextileTexture(), 1.0, 0.8); //Needs Expand filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["Median"]) { sourceImage = ImageUtil.convert(sourceImage, System.Drawing.Imaging.PixelFormat.Format24bppRgb); myFilter = new Median(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["Mean"]) { myFilter = new Mean(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["Blur"]) { myFilter = new GaussianBlur(); filteredImage = myFilter.Apply(sourceImage); } //Console.Write(filteredImage.PixelFormat.ToString()); //Console.Write(sourceImage.PixelFormat.ToString()); filteredImage = ImageUtil.convert(filteredImage, System.Drawing.Imaging.PixelFormat.Format32bppArgb); return(filteredImage); }
public bool Equals([AllowNull] Violin other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return((Type == other.Type && Type != null && other.Type != null && Type.Equals(other.Type)) && (Visible == other.Visible && Visible != null && other.Visible != null && Visible.Equals(other.Visible)) && (ShowLegend == other.ShowLegend && ShowLegend != null && other.ShowLegend != null && ShowLegend.Equals(other.ShowLegend)) && (LegendGroup == other.LegendGroup && LegendGroup != null && other.LegendGroup != null && LegendGroup.Equals(other.LegendGroup)) && (Opacity == other.Opacity && Opacity != null && other.Opacity != null && Opacity.Equals(other.Opacity)) && (UId == other.UId && UId != null && other.UId != null && UId.Equals(other.UId)) && (Equals(Ids, other.Ids) || Ids != null && other.Ids != null && Ids.SequenceEqual(other.Ids)) && (Equals(CustomData, other.CustomData) || CustomData != null && other.CustomData != null && CustomData.SequenceEqual(other.CustomData)) && (Meta == other.Meta && Meta != null && other.Meta != null && Meta.Equals(other.Meta)) && (Equals(MetaArray, other.MetaArray) || MetaArray != null && other.MetaArray != null && MetaArray.SequenceEqual(other.MetaArray)) && (SelectedPoints == other.SelectedPoints && SelectedPoints != null && other.SelectedPoints != null && SelectedPoints.Equals(other.SelectedPoints)) && (HoverInfo == other.HoverInfo && HoverInfo != null && other.HoverInfo != null && HoverInfo.Equals(other.HoverInfo)) && (Equals(HoverInfoArray, other.HoverInfoArray) || HoverInfoArray != null && other.HoverInfoArray != null && HoverInfoArray.SequenceEqual(other.HoverInfoArray)) && (HoverLabel == other.HoverLabel && HoverLabel != null && other.HoverLabel != null && HoverLabel.Equals(other.HoverLabel)) && (Stream == other.Stream && Stream != null && other.Stream != null && Stream.Equals(other.Stream)) && (Equals(Transforms, other.Transforms) || Transforms != null && other.Transforms != null && Transforms.SequenceEqual(other.Transforms)) && (UiRevision == other.UiRevision && UiRevision != null && other.UiRevision != null && UiRevision.Equals(other.UiRevision)) && (Equals(Y, other.Y) || Y != null && other.Y != null && Y.SequenceEqual(other.Y)) && (Equals(X, other.X) || X != null && other.X != null && X.SequenceEqual(other.X)) && (X0 == other.X0 && X0 != null && other.X0 != null && X0.Equals(other.X0)) && (Y0 == other.Y0 && Y0 != null && other.Y0 != null && Y0.Equals(other.Y0)) && (Name == other.Name && Name != null && other.Name != null && Name.Equals(other.Name)) && (Orientation == other.Orientation && Orientation != null && other.Orientation != null && Orientation.Equals(other.Orientation)) && (Bandwidth == other.Bandwidth && Bandwidth != null && other.Bandwidth != null && Bandwidth.Equals(other.Bandwidth)) && (ScaleGroup == other.ScaleGroup && ScaleGroup != null && other.ScaleGroup != null && ScaleGroup.Equals(other.ScaleGroup)) && (ScaleMode == other.ScaleMode && ScaleMode != null && other.ScaleMode != null && ScaleMode.Equals(other.ScaleMode)) && (SpanMode == other.SpanMode && SpanMode != null && other.SpanMode != null && SpanMode.Equals(other.SpanMode)) && (Equals(Span, other.Span) || Span != null && other.Span != null && Span.SequenceEqual(other.Span)) && (Line == other.Line && Line != null && other.Line != null && Line.Equals(other.Line)) && (FillColor == other.FillColor && FillColor != null && other.FillColor != null && FillColor.Equals(other.FillColor)) && (Points == other.Points && Points != null && other.Points != null && Points.Equals(other.Points)) && (Jitter == other.Jitter && Jitter != null && other.Jitter != null && Jitter.Equals(other.Jitter)) && (PointPos == other.PointPos && PointPos != null && other.PointPos != null && PointPos.Equals(other.PointPos)) && (Width == other.Width && Width != null && other.Width != null && Width.Equals(other.Width)) && (Marker == other.Marker && Marker != null && other.Marker != null && Marker.Equals(other.Marker)) && (Text == other.Text && Text != null && other.Text != null && Text.Equals(other.Text)) && (Equals(TextArray, other.TextArray) || TextArray != null && other.TextArray != null && TextArray.SequenceEqual(other.TextArray)) && (HoverText == other.HoverText && HoverText != null && other.HoverText != null && HoverText.Equals(other.HoverText)) && (Equals(HoverTextArray, other.HoverTextArray) || HoverTextArray != null && other.HoverTextArray != null && HoverTextArray.SequenceEqual(other.HoverTextArray)) && (HoverTemplate == other.HoverTemplate && HoverTemplate != null && other.HoverTemplate != null && HoverTemplate.Equals(other.HoverTemplate)) && (Equals(HoverTemplateArray, other.HoverTemplateArray) || HoverTemplateArray != null && other.HoverTemplateArray != null && HoverTemplateArray.SequenceEqual(other.HoverTemplateArray)) && (Box == other.Box && Box != null && other.Box != null && Box.Equals(other.Box)) && (MeanLine == other.MeanLine && MeanLine != null && other.MeanLine != null && MeanLine.Equals(other.MeanLine)) && (Side == other.Side && Side != null && other.Side != null && Side.Equals(other.Side)) && (OffsetGroup == other.OffsetGroup && OffsetGroup != null && other.OffsetGroup != null && OffsetGroup.Equals(other.OffsetGroup)) && (AlignmentGroup == other.AlignmentGroup && AlignmentGroup != null && other.AlignmentGroup != null && AlignmentGroup.Equals(other.AlignmentGroup)) && (Selected == other.Selected && Selected != null && other.Selected != null && Selected.Equals(other.Selected)) && (Unselected == other.Unselected && Unselected != null && other.Unselected != null && Unselected.Equals(other.Unselected)) && (HoverOn == other.HoverOn && HoverOn != null && other.HoverOn != null && HoverOn.Equals(other.HoverOn)) && (XAxis == other.XAxis && XAxis != null && other.XAxis != null && XAxis.Equals(other.XAxis)) && (YAxis == other.YAxis && YAxis != null && other.YAxis != null && YAxis.Equals(other.YAxis)) && (IdsSrc == other.IdsSrc && IdsSrc != null && other.IdsSrc != null && IdsSrc.Equals(other.IdsSrc)) && (CustomDataSrc == other.CustomDataSrc && CustomDataSrc != null && other.CustomDataSrc != null && CustomDataSrc.Equals(other.CustomDataSrc)) && (MetaSrc == other.MetaSrc && MetaSrc != null && other.MetaSrc != null && MetaSrc.Equals(other.MetaSrc)) && (HoverInfoSrc == other.HoverInfoSrc && HoverInfoSrc != null && other.HoverInfoSrc != null && HoverInfoSrc.Equals(other.HoverInfoSrc)) && (YSrc == other.YSrc && YSrc != null && other.YSrc != null && YSrc.Equals(other.YSrc)) && (XSrc == other.XSrc && XSrc != null && other.XSrc != null && XSrc.Equals(other.XSrc)) && (TextSrc == other.TextSrc && TextSrc != null && other.TextSrc != null && TextSrc.Equals(other.TextSrc)) && (HoverTextSrc == other.HoverTextSrc && HoverTextSrc != null && other.HoverTextSrc != null && HoverTextSrc.Equals(other.HoverTextSrc)) && (HoverTemplateSrc == other.HoverTemplateSrc && HoverTemplateSrc != null && other.HoverTemplateSrc != null && HoverTemplateSrc.Equals(other.HoverTemplateSrc))); }
public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (Type != null) { hashCode = hashCode * 59 + Type.GetHashCode(); } if (Visible != null) { hashCode = hashCode * 59 + Visible.GetHashCode(); } if (ShowLegend != null) { hashCode = hashCode * 59 + ShowLegend.GetHashCode(); } if (LegendGroup != null) { hashCode = hashCode * 59 + LegendGroup.GetHashCode(); } if (Opacity != null) { hashCode = hashCode * 59 + Opacity.GetHashCode(); } if (UId != null) { hashCode = hashCode * 59 + UId.GetHashCode(); } if (Ids != null) { hashCode = hashCode * 59 + Ids.GetHashCode(); } if (CustomData != null) { hashCode = hashCode * 59 + CustomData.GetHashCode(); } if (Meta != null) { hashCode = hashCode * 59 + Meta.GetHashCode(); } if (MetaArray != null) { hashCode = hashCode * 59 + MetaArray.GetHashCode(); } if (SelectedPoints != null) { hashCode = hashCode * 59 + SelectedPoints.GetHashCode(); } if (HoverInfo != null) { hashCode = hashCode * 59 + HoverInfo.GetHashCode(); } if (HoverInfoArray != null) { hashCode = hashCode * 59 + HoverInfoArray.GetHashCode(); } if (HoverLabel != null) { hashCode = hashCode * 59 + HoverLabel.GetHashCode(); } if (Stream != null) { hashCode = hashCode * 59 + Stream.GetHashCode(); } if (Transforms != null) { hashCode = hashCode * 59 + Transforms.GetHashCode(); } if (UiRevision != null) { hashCode = hashCode * 59 + UiRevision.GetHashCode(); } if (Y != null) { hashCode = hashCode * 59 + Y.GetHashCode(); } if (X != null) { hashCode = hashCode * 59 + X.GetHashCode(); } if (X0 != null) { hashCode = hashCode * 59 + X0.GetHashCode(); } if (Y0 != null) { hashCode = hashCode * 59 + Y0.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (Orientation != null) { hashCode = hashCode * 59 + Orientation.GetHashCode(); } if (Bandwidth != null) { hashCode = hashCode * 59 + Bandwidth.GetHashCode(); } if (ScaleGroup != null) { hashCode = hashCode * 59 + ScaleGroup.GetHashCode(); } if (ScaleMode != null) { hashCode = hashCode * 59 + ScaleMode.GetHashCode(); } if (SpanMode != null) { hashCode = hashCode * 59 + SpanMode.GetHashCode(); } if (Span != null) { hashCode = hashCode * 59 + Span.GetHashCode(); } if (Line != null) { hashCode = hashCode * 59 + Line.GetHashCode(); } if (FillColor != null) { hashCode = hashCode * 59 + FillColor.GetHashCode(); } if (Points != null) { hashCode = hashCode * 59 + Points.GetHashCode(); } if (Jitter != null) { hashCode = hashCode * 59 + Jitter.GetHashCode(); } if (PointPos != null) { hashCode = hashCode * 59 + PointPos.GetHashCode(); } if (Width != null) { hashCode = hashCode * 59 + Width.GetHashCode(); } if (Marker != null) { hashCode = hashCode * 59 + Marker.GetHashCode(); } if (Text != null) { hashCode = hashCode * 59 + Text.GetHashCode(); } if (TextArray != null) { hashCode = hashCode * 59 + TextArray.GetHashCode(); } if (HoverText != null) { hashCode = hashCode * 59 + HoverText.GetHashCode(); } if (HoverTextArray != null) { hashCode = hashCode * 59 + HoverTextArray.GetHashCode(); } if (HoverTemplate != null) { hashCode = hashCode * 59 + HoverTemplate.GetHashCode(); } if (HoverTemplateArray != null) { hashCode = hashCode * 59 + HoverTemplateArray.GetHashCode(); } if (Box != null) { hashCode = hashCode * 59 + Box.GetHashCode(); } if (MeanLine != null) { hashCode = hashCode * 59 + MeanLine.GetHashCode(); } if (Side != null) { hashCode = hashCode * 59 + Side.GetHashCode(); } if (OffsetGroup != null) { hashCode = hashCode * 59 + OffsetGroup.GetHashCode(); } if (AlignmentGroup != null) { hashCode = hashCode * 59 + AlignmentGroup.GetHashCode(); } if (Selected != null) { hashCode = hashCode * 59 + Selected.GetHashCode(); } if (Unselected != null) { hashCode = hashCode * 59 + Unselected.GetHashCode(); } if (HoverOn != null) { hashCode = hashCode * 59 + HoverOn.GetHashCode(); } if (XAxis != null) { hashCode = hashCode * 59 + XAxis.GetHashCode(); } if (YAxis != null) { hashCode = hashCode * 59 + YAxis.GetHashCode(); } if (IdsSrc != null) { hashCode = hashCode * 59 + IdsSrc.GetHashCode(); } if (CustomDataSrc != null) { hashCode = hashCode * 59 + CustomDataSrc.GetHashCode(); } if (MetaSrc != null) { hashCode = hashCode * 59 + MetaSrc.GetHashCode(); } if (HoverInfoSrc != null) { hashCode = hashCode * 59 + HoverInfoSrc.GetHashCode(); } if (YSrc != null) { hashCode = hashCode * 59 + YSrc.GetHashCode(); } if (XSrc != null) { hashCode = hashCode * 59 + XSrc.GetHashCode(); } if (TextSrc != null) { hashCode = hashCode * 59 + TextSrc.GetHashCode(); } if (HoverTextSrc != null) { hashCode = hashCode * 59 + HoverTextSrc.GetHashCode(); } if (HoverTemplateSrc != null) { hashCode = hashCode * 59 + HoverTemplateSrc.GetHashCode(); } return(hashCode); } }
/// <summary> /// 终测命令 /// </summary> private void ExecuteTest() { bool isSaveData = false; StringBuilder strBuild = new StringBuilder(); IsTestEnable = false; try { //另一线程执行该方法 Thread thread = new Thread(() => { //SN if (!string.IsNullOrEmpty(SN)) { TestingPara.SN = SN; } //GPIB通信 if (IsReady) { double ini = IniAtt; double span = 0.2; double voltage; double saturation = 0; //Hp8156A.Open(); Mp2100A.AutoScale(); Aq6317B.SetSingle(); //Supply Current SupplyCurrent = AgE3631A.GetCurrent(); TestingPara.SupplyCurrent = SupplyCurrent.ToString("F3"); //OutputPower OutputPower = Hp8153A.ReadPower("2"); TestingPara.OutputPower = OutputPower.ToString("F3"); //SD_Desserted SD_High for (int i = 0; i <= 40; i++) { Hp8156A.SetAtt(ini.ToString()); Thread.Sleep(300); voltage = Ag34401A.GetVoltage(); Thread.Sleep(100); if (i == 0 && voltage >= 2.0) { MessageBox.Show("初始即为高电压,请检查设备连接!", "系统提示"); return; } if (voltage >= 2.0) { SdDesserted = ini; TestingPara.SD_Desserted = SdDesserted.ToString(); SDHigh = voltage; TestingPara.SD_High = SDHigh.ToString("F3"); //SdDesserted SdHigh strBuild.Append(string.Format("SdDesserted:{0}", SdDesserted)); strBuild.Append(string.Format("SdHigh:{0}", SDHigh)); DisplayInfo = strBuild.ToString(); break; } else { ini += span; if (i == 40) { strBuild.Append("获取SdDesserted失败!"); DisplayInfo = strBuild.ToString(); } } } ; //SD_Asserted,SD_Low for (int i = 0; i <= 30; i++) { Hp8156A.SetAtt(ini.ToString()); Thread.Sleep(200); voltage = Ag34401A.GetVoltage(); Thread.Sleep(100); if (voltage < 0.5) { SdAsserted = ini; TestingPara.SD_Asserted = SdAsserted.ToString(); SDLow = voltage; TestingPara.SD_Low = SDLow.ToString(); strBuild.Append(string.Format("SdAsserted:{0}", SdAsserted)); strBuild.Append(string.Format("SdLow:{0}", SDLow)); DisplayInfo = strBuild.ToString(); break; } else { ini -= span; if (i == 30) { strBuild.Append("获取SdAsserted失败"); DisplayInfo = strBuild.ToString(); } } } //Hysteresis Hysteresis = SdDesserted = SdAsserted; TestingPara.Hysteresis = Hysteresis.ToString(); #region MP2100 Hp8156A.SetAtt(IniAtt.ToString()); //Exit.Ratio ExtiRatio = Mp2100A.GetExRatio(); TestingPara.ExtioRatio = ExtiRatio.ToString("F3"); strBuild.Append(string.Format("Extinction Ratio:{0}", ExtiRatio)); DisplayInfo = strBuild.ToString(); //Crossing CrossingRate = Mp2100A.GetCrossing(); TestingPara.Crossing = CrossingRate.ToString("F3"); strBuild.Append(string.Format("CrossingRate:{0}", CrossingRate)); DisplayInfo = strBuild.ToString(); //MaskMargin MaskMargin = Mp2100A.GetMaskMargin(); TestingPara.MaskMargin = MaskMargin.ToString("F3"); strBuild.Append(string.Format("Mask Margin:{0}", MaskMargin)); DisplayInfo = strBuild.ToString(); //Jitter Jitter = Mp2100A.GetJitter(); TestingPara.Jitter = Jitter.ToString("F3"); strBuild.Append(string.Format("Jitter:{0}", Jitter)); DisplayInfo = strBuild.ToString(); Thread.Sleep(2000); //OSA string osaData = Aq6317B.GetData(); string[] data = osaData.Split(','); //CenterWavelength if (double.TryParse(data[1].Trim(), out double data1)) { CenterWavelength = data1; } else { CenterWavelength = 0; } TestingPara.CenterWavelength = CenterWavelength.ToString(); //SMSR if (double.TryParse(data[4].Trim(), out double data4)) { SMSR = data4; } else { SMSR = 0; } TestingPara.SMSR = SMSR.ToString(); //WavelengthDiff if (double.TryParse(data[0].Trim(), out double data0)) { DifferenceWavelength = data0; } else { DifferenceWavelength = 0; } TestingPara.WavelengthDiff = DifferenceWavelength.ToString(); strBuild.AppendLine(string.Format("中心波长:{0}", CenterWavelength)); strBuild.AppendLine(string.Format("Δλ:{0}", DifferenceWavelength)); strBuild.AppendLine(string.Format("SMSR:{0}", SMSR)); DisplayInfo = strBuild.ToString(); //Sensitivity Sensitivity = Math.Round(GetSensitivity(), 2); TestingPara.Sensitivity = Sensitivity.ToString(); strBuild.Append(string.Format("Sensitivity:{0}", Sensitivity)); DisplayInfo = strBuild.ToString(); #endregion Thread.Sleep(300); //Saturation //测试饱和度 设置 衰减 Hp8156A.SetAtt(AttInSaturation); Thread.Sleep(3000); for (int i = 0; i < 5; i++) { Thread.Sleep(300); double r = Mp2100A.GetErrorRate(); if (r >= 0) { saturation = Math.Log10(r); if (saturation > -9) { Saturation = false; break; } } else { MessageBox.Show("读取眼图仪误码率发生错误", "系统设置"); break; } Saturation = true; } TestingPara.Saturation = Saturation; strBuild.Append(string.Format("Saturation:{0}", Saturation)); DisplayInfo = strBuild.ToString(); //TxDisable Thread.Sleep(200); Hp8156A.Close(); P3202.SetVolage("1", "2.0"); Thread.Sleep(3000); double txDisablePower = Hp8153A.ReadPower("2"); strBuild.Append(string.Format("Power@TxDisable:{0}", txDisablePower)); DisplayInfo = strBuild.ToString(); if (txDisablePower < -20.0 || Math.Log10(txDisablePower) > 10) { TxDisable = true; TestingPara.TxDisable = true; } P3202.SetVolage("1", "0.8"); isSaveData = true; } else { MessageBox.Show("设备初始化未完成,将无法进行GPIB测试", "系统提示"); } //IIC通信参数 if (IsPortReady) { I2CTest(); isSaveData = true; } else { MessageBox.Show("串口初始化未完成", "系统提示"); } if (isSaveData) { //将数据存储到本地 MessageBoxResult result = MessageBox.Show("测试完成,是否储存数据?", "系统提示", MessageBoxButton.OKCancel, MessageBoxImage.Question); if (result == MessageBoxResult.OK) { bool isEmpty = false; if (!Directory.Exists(@"E:\Xu")) { Directory.CreateDirectory(@"E:\Xu"); } using (FileStream fs = new FileStream(SavePath, FileMode.OpenOrCreate, FileAccess.Read, FileShare.None)) { using (StreamReader sr = new StreamReader(fs)) { string output = null; if ((output = sr.ReadLine()) == null) { isEmpty = true; } else { isEmpty = false; } } } using (FileStream fs = new FileStream(SavePath, FileMode.Append, FileAccess.Write, FileShare.None)) { using (StreamWriter sw = new StreamWriter(fs)) { if (isEmpty == true) { sw.WriteLine("SN,SupplyCurrent,OutputPower,ExRatio,Crossing,Jitter,MaskMargin," + "CenterWavelength,SMSR,WavelengthDiff,TxDisable,Sensitivity,SD_Asserted,SD_Desserted," + "Hysteresis,SD_High,SD_Low,Saturation,RxPoint1,RxPoint2,RxPoint3,TxPower," + "Vcc,Temp,Bias,IsAwPass,Date"); } sw.WriteLine(TestingPara.ToString()); } } } } IsTestEnable = true; }); thread.IsBackground = true; thread.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message, "系统提示"); } }
public CollisionSystem(Jitter.World world, Dictionary<RigidBody, Jitter.Dynamics.RigidBody> worldItems) { World = world; WorldItems = worldItems; }
public Bitmap JitterFilter(Bitmap img) { Jitter jitter = new Jitter(); return(jitter.Apply(img)); }
RigidBody CreateRigidBody(Jitter.Collision.Shapes.Shape shape, bool isStatic) { var body = new RigidBody(shape); if (isStatic) { body.IsStatic = true; body.EnableDebugDraw = true; body.Material.KineticFriction = 1.0f; } else { body.IsActive = true; body.EnableDebugDraw = true; body.Material.KineticFriction = 1.0f; body.IsStatic = false; } return body; }
public void Throws_An_ArgumentNullException_If_Settings_Is_Null() { // act + assert Assert.Throws <ArgumentNullException>(() => Jitter.Apply(100d, null)); }
public void DrawPoint(Jitter.LinearMath.JVector pos) { // TODO }
public static Vector3 ToXNAVector(Jitter.LinearMath.JVector vector) { return new Vector3(vector.X, vector.Y, vector.Z); }
public JitterFilter() { jitter = new Jitter(); jitter.Radius = 6; }
public JitterRigidBodyHandler(Jitter.World world) { this.world = world; items = new Dictionary<string, RigidBody>(); worldItems = new Dictionary<RigidBody, Jitter.Dynamics.RigidBody>(); }
public void DrawLine(Jitter.LinearMath.JVector start, Jitter.LinearMath.JVector end) { // TODO }
internal Body(Jitter.Dynamics.RigidBody rigidBody) { RigidBody = rigidBody; RigidBody.EnableSpeculativeContacts = true; }
private bool RaycastCallback(Jitter.Dynamics.RigidBody body, JVector normal, float fraction) { // prevent the ray to collide with ourself! return (body != this.Body1); }
public Point UVPoint(int u, int v) => Corner + U * (u + Jitter.Next()) + V * (v + Jitter.Next());
public async Task <IEnumerable <JitResult> > Update(Jitter jitter) { if (doc == null) { return(empty); } var offset = doc.Editor.CaretOffset; var proj = doc.Project; if (proj == null) { return(empty); } var roslynDoc = doc.AnalysisDocument; if (roslynDoc == null) { return(empty); } cancellationTokenSource.Cancel(); cancellationTokenSource = new CancellationTokenSource(); var token = cancellationTokenSource.Token; return(await Task.Run(async() => { var sm = await roslynDoc.GetSemanticModelAsync(token); // member var memberSymbol = sm.GetEnclosingSymbol(offset, token); if (memberSymbol == null) { return empty; } string[] parameterTypeNames = Array.Empty <string>(); if (memberSymbol is IMethodSymbol methodSymbol) { parameterTypeNames = methodSymbol.Parameters.Select(x => x.Type.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat)).ToArray(); } else if (!(memberSymbol is IPropertySymbol)) { return empty; } var compilation = await roslynDoc.Project.GetCompilationAsync(token); var tempFile = Path.GetTempFileName(); try { using (var stream = File.OpenWrite(tempFile)) { var emitResult = compilation.Emit(stream, options: new Microsoft.CodeAnalysis.Emit.EmitOptions() cancellationToken: token); } if (!emitResult.Success) { return Enumerable.Repeat(JitResult.Error, 1); } var result = new CompileResult(tempFile); // type var typeName = memberSymbol.ContainingType.ToDisplayString(format); return jitter.Jit(result, new MethodDescription(typeName, memberSymbol.MetadataName, parameterTypeNames)); } finally { File.Delete(tempFile); } }, token)); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { IGH_Goo goo = null; Image image = new Image(); if (!DA.GetData(0, ref goo)) { return; } if (!goo.TryGetImage(ref image)) { return; } int mode = 0; DA.GetData(1, ref mode); double numValA = 0; DA.GetData(2, ref numValA); double numValB = 0; DA.GetData(3, ref numValB); Filter filter = new Filter(); switch ((FilterModes)mode) { case FilterModes.Additive: SetParameter(2); SetParameter(3); filter = new Additive(); image.Filters.Add(new Additive()); break; case FilterModes.Daube: SetParameter(2, "S", "Size", "[0-1] Unitized adjustment value"); SetParameter(3); filter = new Daube(numValA); image.Filters.Add(new Daube(numValA)); break; case FilterModes.SaltPepper: SetParameter(2, "N", "Noise", "[0-1] Unitized adjustment value"); SetParameter(3); filter = new SaltPepper(numValA); image.Filters.Add(new SaltPepper(numValA)); break; case FilterModes.Jitter: SetParameter(2, "R", "Radius", "[0-1] Unitized adjustment value"); SetParameter(3); filter = new Jitter(numValA); image.Filters.Add(new Jitter(numValA)); break; case FilterModes.Kuwahara: SetParameter(2, "S", "Size", "[0-1] Unitized adjustment value"); SetParameter(3); filter = new Kuwahara(numValA); image.Filters.Add(new Kuwahara(numValA)); break; case FilterModes.Posterize: SetParameter(2, "I", "Interval", "[0-1] Unitized adjustment value"); SetParameter(3); filter = new Posterize(numValA); image.Filters.Add(new Posterize(numValA)); break; case FilterModes.GaussianBlur: SetParameter(2, "X", "Sigma", "[0-1] Unitized adjustment value"); SetParameter(3, "S", "Size", "[0-1] Unitized adjustment value"); filter = new GaussianBlur(numValA, numValB); image.Filters.Add(new GaussianBlur(numValA, numValB)); break; case FilterModes.Pixellate: SetParameter(2, "W", "Width", "[0-1] Unitized adjustment value"); SetParameter(3, "H", "Height", "[0-1] Unitized adjustment value"); filter = new Pixellate(numValA, numValB); image.Filters.Add(new Pixellate(numValA, numValB)); break; case FilterModes.Blur: SetParameter(2, "D", "Divisor", "[0-1] Unitized adjustment value"); SetParameter(3, "T", "Threshold", "[0-1] Unitized adjustment value"); filter = new Blur(numValA, numValB); image.Filters.Add(new Blur(numValA, numValB)); break; } message = ((FilterModes)mode).ToString(); UpdateMessage(); DA.SetData(0, image); DA.SetData(1, filter); }