Home > Net >  C # how like natural syntax to define a three dimensional coordinates (1, 2, 3) for bosses to solve!
C # how like natural syntax to define a three dimensional coordinates (1, 2, 3) for bosses to solve!

Time:10-12

I know there is a 2 d coordinates of the class, but how also don't do 3 d coordinates, strives for the bosses to solve

CodePudding user response:

Public class ThreeDimensional
(
Public double X {get; The set; }
Public double Y {get; The set; }
Public double Z {get; The set; }
)
More simple and crude

CodePudding user response:

Using c # and Microsoft managed D3D, data resources from the Internet

Elevation is using GDAL library reading from the TIFF file

Read TIFF source download https://download.csdn.net/download/mosangbike/6667651

C # graphics technology exchange group

CodePudding user response:

reference 1st floor Dear200892 response:
public class ThreeDimensional
(
Public double X {get; The set; }
Public double Y {get; The set; }
Public double Z {get; The set; }
)
More simple and crude
the structure better not use?

CodePudding user response:

Arr [] []

CodePudding user response:

Float [] [] [] axis=new float [] [] [] {}

CodePudding user response:

Multidimensional arrays can feel to do this

CodePudding user response:

The definition of operation, for example, cube
 
using System;

Public class Math3D
{
Public class Point3D
{
Public double X;
Public double Y;
Public double Z;

Public Point3D (int x, int y, int z)
{
X=X;
Y=Y;
Z=Z;//is set to 1 in the example
}

Public Point3D (float x, float y, float z)
{
X=(double) X;
Y=(double) Y;
Z=(double) Z;
}

Public Point3D (double x, double y, double z)
{
X=X;
Y=Y;
Z=Z;
}

Public Point3D ()
{
}

Public override string ToString ()
{
Return "(" + X.T oString () +", "+ Y.T oString () +", "+ Z.T oString () +") ";
}
}

Public class Camera
{
Public Point3D Position=new Point3D ();
}

Public static Point3D RotateX (Point3D Point3D, double degrees)
{
Double cDegrees=(Math. PI * degrees)/180.0 f;
Double cosDegrees=Math. Cos (cDegrees);
Double sinDegrees=Math. Sin (cDegrees);
Double y=(point3D. Y * cosDegrees) + (point3D. Z * sinDegrees);
Double z=(point3D. * Y - sinDegrees) + (point3D. Z * cosDegrees);
Return new Point3D (Point3D. X, y, z);
}

Public static Point3D RotateY (Point3D Point3D, double degrees)
{
Double cDegrees=(Math. PI * degrees)/180.0;
Double cosDegrees=Math. Cos (cDegrees);
Double sinDegrees=Math. Sin (cDegrees);
Double x=(point3D. X * cosDegrees) + (point3D. Z * sinDegrees);
Double z=(point3D. * X - sinDegrees) + (point3D. Z * cosDegrees);
Return new Point3D (x, Point3D. J Y, z);
}

Public static Point3D RotateZ (Point3D Point3D, double degrees)
{
Double cDegrees=(Math. PI * degrees)/180.0;
Double cosDegrees=Math. Cos (cDegrees);
Double sinDegrees=Math. Sin (cDegrees);
Double x=(point3D. X * cosDegrees) + (point3D. Y * sinDegrees);
Double y=(point3D. * X - sinDegrees) + (point3D. Y * cosDegrees);
Return new Point3D (x, y, Point3D. Z);
}

Public static Point3D Translate (Point3D points3D, Point3D oldOrigin, Point3D newOrigin)
{
Point3D difference=new Point3D (newOrigin. X-ray oldOrigin. X, newOrigin. - oldOrigin. Y Y, newOrigin. Z - oldOrigin. Z);
Points3D. X +=difference. X;
Points3D. + Y=difference. Y;
Points3D. Z +=difference. Z;
Return points3D;
}

Public static Point3D [] RotateX (Point3D [] points3D, double degrees)
{
for (int i=0; i {
Points3D [I]=RotateX (points3D [I], degrees);
}
Return points3D;
}

Public static Point3D [] RotateY (Point3D [] points3D, double degrees)
{
for (int i=0; i {
Points3D [I]=RotateY (points3D [I], degrees);
}
Return points3D;
}

Public static Point3D [] RotateZ (Point3D [] points3D, double degrees)
{
for (int i=0; i {
Points3D [I]=RotateZ (points3D [I], degrees);
}
Return points3D;
}

Public static Point3D [] Translate (Point3D [] points3D, Point3D oldOrigin, Point3D newOrigin)
{
for (int i=0; i {
Points3D [I]=Translate (points3D [I], oldOrigin, newOrigin);
}
Return points3D;
}

}


Width of 1 example https://pan.baidu.com/s/1rDjOj-_OC6W0v8iaMl_jNQ

CodePudding user response:

Arr [] [] become

Matix=new double double [] [] [] [] {{x1, y1, z1}, {x2, y2, z3}}

CodePudding user response:

refer to 7th floor desperaso response:
cube definition of operation, for example,
 
using System;

Public class Math3D
{
Public class Point3D
{
Public double X;
Public double Y;
Public double Z;

Public Point3D (int x, int y, int z)
{
X=X;
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • C #