Skip to content

Fix documentation #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions docs/Plots/Axiality.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

[preview]: img/Axiality.png "Axiality plot"
[preview]: gfx/Axiality.png "Axiality plot"
<br/>
### Axiality plot

Expand All @@ -25,10 +25,11 @@ The plot can display a height axis. The range of the axis is determined by multi

```csharp
var plot = new CylindricityPlot();
var points = new List<CylinderPoint>();

var segment = new Segment<CylinderPoint, CylinderGeometry>( "All", SegmentTypes.Axis );
plot.Segments.Add( segment )

var rand = new Random( DateTime.Now.Millisecond );
var segment = new Segment( "All", SegmentTypes.Axis);

//The range of the displayed z-axis will be this height multiplied with the points height range.
plot.Actual.Height = 10;
Expand All @@ -38,13 +39,13 @@ for( var i = 0; i < count; i++ )
var deviation = 0.2 + rand.NextDouble() * 0.1;
var height = (double)i / count;

var point = new CylinderPoint( segment, rand.NextDouble() * 0.1, height, deviation );
points.Add( point );
var point = new CylinderPoint( rand.NextDouble() * 0.1, height, deviation );

segment.Points.Add( point );
}

plot.Tolerance = new Tolerance( -0.1, 0.1 );
plot.DefaultErrorScaling = 100;
plot.Points = points;
```

#### Remarks
Expand Down
13 changes: 7 additions & 6 deletions docs/Plots/Circle.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[preview]: img/Circle.png "Circle plot"
[preview]: gfx/Circle.png "Circle plot"
<br/>
### Circle plot

Expand All @@ -23,23 +23,24 @@ Although the circle plot geometry has a radius parameter, it has no effect for d

```csharp
var plot = new RoundnessPlot();
var points = new List<CirclePoint>();

var segment = new Segment<CirclePoint, CircleGeometry>( "All", SegmentTypes.Circle );
plot.Segments.Add( segment )

var rand = new Random( DateTime.Now.Millisecond );
var segment = new Segment( "All", SegmentTypes.None );

for( var i = 0; i < count; i++ )
{
var angle = ( double ) i / count * 2.0 * Math.PI;
var deviation = 0.1 * ( Math.Sin( angle ) + ( rand.NextDouble() - 0.5 ) * 0.2 );

var point = new CirclePoint( segment, angle, deviation );
points.Add( point );
var point = new CirclePoint( angle, deviation );

segment.Points.Add( point );
}

plot.Tolerance = new Tolerance( -0.1, 0.1 );
plot.DefaultErrorScaling = 100;
plot.Points = points;
```

#### Remarks
Expand Down
27 changes: 14 additions & 13 deletions docs/Plots/CircleInProfile.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[preview]: img/CircleInProfile.png "Circle-in-profile plot"
[preview]: gfx/CircleInProfile.png "Circle-in-profile plot"
<br/>
### Circle-in-profile plot

Expand All @@ -22,9 +22,11 @@ These special points can be part of the plots point list, but are usually define

```csharp
var plot = new CircleInProfilePlot();
var points = new List<CircleInProfilePoint>();

var segment = new Segment<CircleInProfilePoint, CircleInProfileGeometry>( "All", SegmentTypes.Line );
plot.Segments.Add( segment )

var rand = new Random( DateTime.Now.Millisecond );
var segment = new Segment( "All", SegmentTypes.Circle );

var angleShift = ( rand.NextDouble() - 0.5 ) * 0.25;

Expand All @@ -33,45 +35,44 @@ for( var i = 0; i < count; i++ )
var angle = (double)i / count * Math.PI;

var deviation = Math.Abs( Math.Sin( angle ) - Math.Sin( 0.25 * Math.PI ) ) * 0.1 + ( rand.NextDouble() - 0.5 ) * 0.005;
var point = new CircleInProfilePoint( segment, angle + angleShift, deviation );
var point = new CircleInProfilePoint( angle + angleShift, deviation );


if( i == count / 4 )
{
plot.Nominal.FirstTouchingPoint = new CircleInProfilePoint( segment, angle, 0 );
plot.Nominal.FirstTouchingPoint = new CircleInProfilePoint( angle, 0 );

//To create an angular tolerance, add it to the actual touching points.
//The tolerance spans around the nominal touching point angle.
plot.Actual.FirstTouchingPoint = new CircleInProfilePoint( segment, point.Angle, point.Deviation )
plot.Actual.FirstTouchingPoint = new CircleInProfilePoint( point.Angle, point.Deviation )
{
Tolerance = new Tolerance( -0.1, 0.1 )
};
}

if( i == count / 4 * 3 )
{
plot.Nominal.SecondTouchingPoint = new CircleInProfilePoint( segment, angle, 0 );
plot.Nominal.SecondTouchingPoint = new CircleInProfilePoint( angle, 0 );

//To create an angular tolerance, add it to the actual touching points.
//The tolerance spans around the nominal touching point angle.
plot.Actual.SecondTouchingPoint = new CircleInProfilePoint( segment, point.Angle, point.Deviation )
plot.Actual.SecondTouchingPoint = new CircleInProfilePoint( point.Angle, point.Deviation )
{
Tolerance = new Tolerance( -0.1, 0.1 )
};
}

if( i == count / 2 )
{
plot.Nominal.MaxGapPoint = new CircleInProfilePoint( segment, angle, 0 );
plot.Actual.MaxGapPoint = new CircleInProfilePoint( segment, point.Angle, point.Deviation );
plot.Nominal.MaxGapPoint = new CircleInProfilePoint( angle, 0 );
plot.Actual.MaxGapPoint = new CircleInProfilePoint( point.Angle, point.Deviation );
}

points.Add( point );
segment.Points.Add( point );
}

plot.Tolerance = new Tolerance( 0.1 );
plot.DefaultErrorScaling = 250;
plot.Points = points;
```
<br/>
<br/>
13 changes: 7 additions & 6 deletions docs/Plots/Cylindricity.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[preview]: img/Cylindricity.png "Cylindricity plot"
[preview]: gfx/Cylindricity.png "Cylindricity plot"
<br/>
### Cylindricity plot

Expand All @@ -24,10 +24,11 @@ The plot can display a height axis. The range of the axis is determined by multi

```csharp
var plot = new CylindricityPlot();
var points = new List<CylinderPoint>();

var segment = new Segment<CylinderPoint, CylinderGeometry>( "All", SegmentTypes.Helix );
plot.Segments.Add( segment )

var rand = new Random( DateTime.Now.Millisecond );
var segment = new Segment( "All", SegmentTypes.Helix );

//The range of the displayed z-axis will be this height multiplied with the points height range.
plot.Actual.Height = 10;
Expand All @@ -38,13 +39,13 @@ for( var i = 0; i < count; i++ )
var deviation = 0.1 * ( Math.Sin( angle ) + ( rand.NextDouble() - 0.5 ) * 0.2 );
var height = ( double ) i / count;

var point = new CylinderPoint( segment, angle, height, deviation );
points.Add( point );
var point = new CylinderPoint( angle, height, deviation );

segment.Points.Add( point );
}

plot.Tolerance = new Tolerance( -0.1, 0.1 );
plot.DefaultErrorScaling = 100;
plot.Points = points;
```

#### Remarks
Expand Down
15 changes: 8 additions & 7 deletions docs/Plots/Defect.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[preview]: img/Defect.png "Defect file format"
[preview]: gfx/Defect.png "Defect file format"
<br/>

### Defect plot
Expand All @@ -13,7 +13,7 @@ The defect file format is used to transport information about one or more defect

The format defines one point for every defect, which has a `Position` and a `Size` parameter. Be aware, that the `Position` refers to the corner of the defects bounding box, which is closest to the point of origin.

![defect position](img/DefectPosition.png "Defect position")
![defect position](gfx/DefectPosition.png "Defect position")

Besides the `Position` and `Size` parameters, every point contains an arbitrary number of `Voxels` that define its shape. Be aware that both, the defect `Size` and `Position` as well as the voxel `Size` and `Position` are double values. We suggest to specify all positions and sizes in voxel coordinates and to specify the properties described in the [Geometry](#geometry) section.

Expand Down Expand Up @@ -41,7 +41,9 @@ To allow PiWeb to create various visualizations of your data, you can specify ad
public static Formplot Create( BitmapSource img )
{
var plot = new DefectPlot();
var points = new List<Defect>();

var segment = new Segment<Defect, DefectGeometry>( "All", SegmentTypes.None );
plot.Segments.Add( segment );

plot.Nominal.Size = new Vector( img.PixelWidth, img.PixelHeight );

Expand All @@ -59,11 +61,10 @@ public static Formplot Create( BitmapSource img )
continue;

if( IsDefect( position, data ) )
points.Add( DetectDefect( new Pixel( x, y ), data, img.PixelWidth, img.PixelHeight, done ) );
segment.Points.Add( DetectDefect( new Pixel( x, y ), data, img.PixelWidth, img.PixelHeight, done ) );
}
}

plot.Points = points;

return plot;
}
```
Expand Down Expand Up @@ -104,7 +105,7 @@ private static Defect DetectDefect( Pixel origin, byte[] data, int pixelWidth, i

var voxels = found.Select( p => new Voxel( new Vector( p.X, p.Y ), new Vector( 1, 1 ) ) ).ToArray();
var bounds = GetBounds( voxels );
return new Defect( new Segment( "All", SegmentTypes.None ), new Vector( bounds.X, bounds.Y ), new Vector( bounds.Width, bounds.Height ) )
return new Defect( new Vector( bounds.X, bounds.Y ), new Vector( bounds.Width, bounds.Height ) )
{
Voxels = voxels
};
Expand Down
14 changes: 7 additions & 7 deletions docs/Plots/Fourier.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[preview]: img/Fourier.png "Fourier plot"
[preview]: gfx/Fourier.png "Fourier plot"
<br/>
### Fourier plot

Expand All @@ -19,21 +19,21 @@ Fourier points consist of...

```csharp
var plot = new FourierPlot();
var points = new List<FourierPoint>();

var segment = new Segment<FourierPoint, EmptyGeometry>( "All", SegmentTypes.None );
plot.Segments.Add( segment );

var rand = new Random( DateTime.Now.Millisecond );
var segment = new Segment( "All", SegmentTypes.None );

// Harmonics are greater or equal to 1
for( uint harmonic = 1; harmonic <= count; harmonic++ )
{
//No negative amplitudes
var amplitude = ( 1.0 / (1.0 + ( double )harmonic / 1 ) + rand.NextDouble() * 0.2 ) * 0.0025;
var point = new FourierPoint( segment, harmonic, amplitude ) { Tolerance = new Tolerance( null, 0.0003 ) };
points.Add( point );
}
var point = new FourierPoint( harmonic, amplitude ) { Tolerance = new Tolerance( null, 0.0003 ) };

plot.Points = points;
segment.Points.Add( point );
}
```
#### Remarks
* Be aware that the harmonic is stored as an unsigned integer value in network byte order (big endian) and its value must be greater than 0
Expand Down
19 changes: 10 additions & 9 deletions docs/Plots/Generatrix.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[preview]: img/Generatrix.png "Generatrix plot"
[preview]: gfx/Generatrix.png "Generatrix plot"
<br/>
### Generatrix plot

Expand All @@ -24,11 +24,13 @@ The plot can display a height and a radius axis. The range of these axis is dete

```csharp
var plot = new CylindricityPlot();
var points = new List<CylinderPoint>();

var left = new Segment<CylinderPoint, CylinderGeometry>( "Left", SegmentTypes.Line );
var right = new Segment<CylinderPoint, CylinderGeometry>( "Right", SegmentTypes.Line );
plot.Segments.Add( left );
plot.Segments.Add( right );

var rand = new Random( DateTime.Now.Millisecond );
var left = new Segment( "Left", SegmentTypes.Line);
var right = new Segment( "Right", SegmentTypes.Line );

//The x- and y-axis of the plot will span over the radius and height * plotpoints min/max.
plot.Actual.Height = 15;
Expand All @@ -39,16 +41,15 @@ for( var i = 0; i < count; i++ )
var deviation = rand.NextDouble() * 0.1;
var height = (double)i / count;

var point = new CylinderPoint( left, 0.0, height, deviation );
points.Add( point );
var point = new CylinderPoint( 0.0, height, deviation );
left.Points.Add( point );

point = new CylinderPoint( right, 0.5 * Math.PI, height, deviation );
points.Add( point );
point = new CylinderPoint( 0.5 * Math.PI, height, deviation );
right.Points.Add( point );
}

plot.Tolerance = new Tolerance( -0.1, 0.1 );
plot.DefaultErrorScaling = 100;
plot.Points = points;
```

#### Remarks
Expand Down
12 changes: 6 additions & 6 deletions docs/Plots/Line.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[preview]: img/Line.png "Line plot"
[preview]: gfx/Line.png "Line plot"
<br/>
### Line plot

Expand All @@ -24,10 +24,11 @@ The plot axis can be modified with the _actual_ geometry parameters `Length` and

```csharp
var plot = new StraightnessPlot();
var points = new List<LinePoint>();

var segment = new Segment<LinePoint, LineGeometry>( "All", SegmentTypes.None );
plot.Segments.Add( segment );

var rand = new Random( DateTime.Now.Millisecond );
var segment = new Segment( "All", SegmentTypes.None );

plot.Actual.Length = 5.0; //All positions will be multiplied with the length when the plot is drawn.

Expand All @@ -40,14 +41,13 @@ for( var i = 0; i < pointCount; i++ )
{
var position = ( double ) i / pointCount;
var deviation = 0.1 * ( Math.Sin( position * 2.0 * Math.PI ) + ( rand.NextDouble() - 0.5 ) * 0.1 );
var point = new LinePoint( segment, position, deviation );
var point = new LinePoint( position, deviation );

points.Add( point );
segment.Points.Add( point );
}

plot.Tolerance = new Tolerance( -0.1, 0.1 );
plot.DefaultErrorScaling = 100;
plot.Points = points;
```
#### Remarks

Expand Down
14 changes: 7 additions & 7 deletions docs/Plots/LineProfile.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[preview]: img/LineProfile.png "Curve plot"
[preview]: gfx/LineProfile.png "Curve plot"
<br/>
### Line profile plot

Expand All @@ -20,10 +20,11 @@ While the points are specified as three dimensional entities, the plot displays

```csharp
var plot = new CurveProfilePlot();
var points = new List<CurvePoint>();

var segment = new Segment<CurvePoint, CurveGeometry>( "All", SegmentTypes.None );
plot.Segments.Add( segment )

var rand = new Random( DateTime.Now.Millisecond );
var segment = new Segment( "All", SegmentTypes.None );

var lastPosition = new Vector();

Expand All @@ -44,14 +45,13 @@ for( var i = 0; i < count; i++ )
if( i == 0 )
continue;

var point = new CurvePoint( segment, position, direction, deviation );

points.Add( point );
var point = new CurvePoint( position, direction, deviation );
segment.Points.Add( point );
}

plot.Tolerance = new Tolerance( -0.1, 0.1 );
plot.DefaultErrorScaling = 100;
plot.Points = points;
```
<br/>
<br/>
Loading