Simply3DScan
SharedObjects.Extensions Class Reference

Extension methods More...

Static Public Member Functions

static ColorPoint3D Intersection (this Line line1, Line line2)
 Intersections between line 1 and the specified line2. More...
 
static void ChevronFromPoints (this ColorPoint3D point1, ColorPoint3D point2, out double alpha, out double beta)
 Chevrons from points. More...
 
static void SaveImage (this Image image, string imageFolder, string name, int actualSteps, Information configuration)
 Saves the image. More...
 
static IEnumerable< T > Descendants< T > (this Control control)
 Descendantses the specified control. More...
 

Detailed Description

Extension methods

Definition at line 12 of file Extensions.cs.

Member Function Documentation

static void SharedObjects.Extensions.ChevronFromPoints ( this ColorPoint3D  point1,
ColorPoint3D  point2,
out double  alpha,
out double  beta 
)
static

Chevrons from points.

Parameters
point1The point1.
point2The point2.
alphaThe alpha.
betaThe beta.

Definition at line 39 of file Extensions.cs.

40  {
41  alpha = (point2.Z - point1.Z) / (point2.X - point1.X);
42  beta = point1.Z - alpha * point1.X;
43  }
static IEnumerable<T> SharedObjects.Extensions.Descendants< T > ( this Control  control)
static

Descendantses the specified control.

Template Parameters
T
Parameters
controlThe control.
Returns
Type Constraints
T :class 

Definition at line 72 of file Extensions.cs.

72  : class
73  {
74 
75  foreach (Control child in control.Controls)
76  {
77  T childOfT = child as T;
78  if (childOfT != null)
79  {
80  yield return childOfT;
81  }
82 
83  if (!child.HasChildren)
84  continue;
85  foreach (T descendant in Descendants<T>(child))
86  {
87  yield return descendant;
88  }
89  }
90 
91  }
static IEnumerable< T > Descendants< T >(this Control control)
Descendantses the specified control.
Definition: Extensions.cs:72
static ColorPoint3D SharedObjects.Extensions.Intersection ( this Line  line1,
Line  line2 
)
static

Intersections between line 1 and the specified line2.

Parameters
line1The line1.
line2The line2.
Returns

Definition at line 22 of file Extensions.cs.

23  {
24  //intersection of the two coplanar lines
25  ColorPoint3D intersectionPoint3D = new ColorPoint3D((line2.Beta - line1.Beta)/(line1.Alpha - line2.Alpha), 0, 0);
26  intersectionPoint3D.Z = line2.Alpha * intersectionPoint3D.X + line2.Beta;
27  return intersectionPoint3D;
28  }
static void SharedObjects.Extensions.SaveImage ( this Image  image,
string  imageFolder,
string  name,
int  actualSteps,
Information  configuration 
)
static

Saves the image.

Parameters
imageThe image.
imageFolderThe image folder.
nameThe name.
actualStepsThe actual steps.
configurationThe configuration.

Definition at line 55 of file Extensions.cs.

56  {
57  if (!configuration.Places.SaveImages)
58  return;
59  string file =
60  $"Image_{name}_{(configuration.Motor.MicroStepsEnabled ? "MS" : "NS")}{(configuration.Motor.MicroStepsEnabled ? actualSteps : actualSteps*16)}.png";
61  string filePath = Path.Combine(imageFolder, file);
62  image.Save(filePath);
63  }
Places Places
Gets or sets the places.
Definition: Information.cs:59
bool SaveImages
Gets or sets a value indicating whether [save images].
Definition: Places.cs:15

The documentation for this class was generated from the following file: