LEADTOOLS Image Processing (Leadtools.ImageProcessing.Core assembly)
LEAD Technologies, Inc

Complex Constructor (Complex)

Example 





Real part of a complex number.
Imaginary part of a complex number.
Initializes a new Complex object with explicit parameters. .NET support
Syntax
public Complex( 
   double r,
   double i
)
'Declaration
 
Public Function New( _
   ByVal r As Double, _
   ByVal i As Double _
)
'Usage
 
Dim r As Double
Dim i As Double
 
Dim instance As New Complex(r, i)
public Complex( 
   double r,
   double i
)
function Complex( 
   r ,
   i 
)
public:
Complex( 
   double r,
   double i
)

Parameters

r
Real part of a complex number.
i
Imaginary part of a complex number.
Example
 
Public Sub ComplexConstructorExample_S2()
   Dim codecs As New RasterCodecs()
   codecs.ThrowExceptionsOnInvalidImages = True

   Dim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Master.jpg"))

   ' Prepare the command
   Dim com As Complex = New Complex(12.0, 5.0)

   ' Get the real and the imaginary part of the complex number.
   MessageBox.Show("Complex number real part is : " & com.R)
   MessageBox.Show("Complex number Imaginary part is : " & com.I)

End Sub

Public NotInheritable Class LEAD_VARS
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
public void ComplexConstructorExample_S2()
   {
      // Load an image
      RasterCodecs codecs = new RasterCodecs();
      codecs.ThrowExceptionsOnInvalidImages = true;

      RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Master.jpg"));

      // Prepare the command
      // Set the real and the imaginary part of the complex number.
      Complex com = Complex.Empty;

      com.R = 12.0;
      com.I = 5.0;

      Complex com2 = new Complex(com.R, com.I);

      // Get the real and the imaginary part of the complex number.
      MessageBox.Show("Complex number real part is : " + com2.R);
      MessageBox.Show("Complex number Imaginary part is : " + com2.I);

   }

static class LEAD_VARS
{
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
function ComplexConstructorExample_S2()
{
   var codecs = new Leadtools.Codecs.RasterCodecs();
   codecs.throwExceptionsOnInvalidImages = true;

   // Load the image
   var srcFileName = "Assets\\Image1.cmp";
   return Tools.AppInstallFolder().getFileAsync(srcFileName).then(function (loadFile) {
      return codecs.loadAsync(Leadtools.LeadStreamFactory.create(loadFile));
   }).then(function (image) {
      // Prepare the command
      with (Leadtools.ImageProcessing.Core) {
         // Set the real and the imaginary part of the complex number.
         var com = ComplexHelper.empty;

         com.r = 12.0;
         com.i = 5.0;

         var com2 = ComplexHelper.create(com.r, com.i);
         
         // Get the real and the imaginary part of the complex number.
         console.error("Complex number real part is : " + com2.r);
         console.error("Complex number Imaginary part is : " + com2.i);
      }
   });
}
[TestMethod]
public async Task ComplexConstructorExample_S2()
{
   // Load an image
   RasterCodecs codecs = new RasterCodecs();
   codecs.ThrowExceptionsOnInvalidImages = true;
   // Load the image
   string srcFileName = @"Assets\Image1.cmp";
   StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName);
   RasterImage image = await codecs.LoadAsync(LeadStreamFactory.Create(loadFile));

   // Prepare the command
   // Set the real and the imaginary part of the complex number.
   Complex com = ComplexHelper.Empty;

   com.R = 12.0;
   com.I = 5.0;

   Complex com2 = ComplexHelper.Create(com.R, com.I);

   // Get the real and the imaginary part of the complex number.
   Debug.WriteLine("Complex number real part is : " + com2.R);
   Debug.WriteLine("Complex number Imaginary part is : " + com2.I);

}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Complex Structure
Complex Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.