Home > Net >  How to put a lot of three-dimensional rectangle drawn into visual three-dimensional mold by location
How to put a lot of three-dimensional rectangle drawn into visual three-dimensional mold by location

Time:10-08

Cuboid position be drawn into the stereo mode of visual
I have a lot of 3 d coordinate data of the cuboid, including position dimensions, like timeout put goods shelves, layers, each layer has more columns, each column have more than one box, I need to draw them into a three-dimensional model of the visual, need to use technology to achieve or what class libraries, such as the use of c #, or any other tools?

CodePudding user response:

Code is not long, has more than 200 lines,
 
Public class Cube
{
Public int width=0, height=0, the depth=0;
Double xRotation=0.0, yRotation=0.0, zRotation=0.0;
Math3D. Camera camera1=new Math3D. Camera ();
Math3D. Point3D cubeOrigin;
Public Point [and] Area=new Point (6, 4),
Public double RotateX {get {return xRotation; } the set {xRotation=value; }}
Public double RotateY {get {return yRotation; } the set {yRotation=value; }}
Public double RotateZ {get {return zRotation; } the set {zRotation=value; }}
Public Cube (int Width, int Height, int the Depth)
{
Width=width;
Height=height;
The depth=the depth;
CubeOrigin=new Math3D. Point3D (width/2, height/2, the depth/2);
}
Public static Rectangle getBounds (PointF [] points)
{
Double left=points [0]. X;
Double right=points [0]. X;
Double top=points [0]. Y;
Double bottom=points [0]. Y;
for (int i=1; I & lt; Points. The Length; I++)
{
If (points [I] X & lt; Left)
Left=points [I]. X;
If (points [I] X & gt; Right)
Right=points [I]. X;
If (points [I] Y & lt; Top)
Top=points [I] Y;
If (points [I] Y & gt; Bottom)
Bottom=points [I] Y;
}
Return the new Rectangle (0, 0, (int) Math. Round - left (right), (int) Math. Round - top (bottom));
}
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,


Download
https://pan.baidu.com/s/15mJroMcZphg8mzi9GB7v-g




CodePudding user response:

3 d cube good picture, but to be attached on the surface of the each image, need to image deformation processing,
Also don't trouble, two file has more than 300 line, including support for transparent shadow etc.
Download
https://pan.baidu.com/s/15mJroMcZphg8mzi9GB7v-g

But if high real-time requirements, this thing is slow, according to the 800 * 600 size, deformation of 180 degrees, each face of each scale to generate images, a total of about 1.5 seconds (180 image),
Winform do this or not, with WPF or GPU related library operation

CodePudding user response:

Above address is wrong, is the
https://pan.baidu.com/s/1fl6eyQl0JUBOhLbTiz_zgQ

CodePudding user response:

Cattle

CodePudding user response:

refer to the second floor desperaso response:
3 d cube good picture, but should be attached on the surface of the each image to image deformation processing,
Also don't trouble, two file has more than 300 line, including support for transparent shadow etc.
Download
https://pan.baidu.com/s/15mJroMcZphg8mzi9GB7v-g

But if high real-time requirements, this thing is slow, according to the 800 * 600 size, deformation of 180 degrees, each face of each scale to generate images, a total of about 1.5 seconds (180 image),
Winform do this or not, with WPF or GPU operations related library

Hello, the inside of the vector class methods show that does not exist, I'm using the WPF, which is the vector should be namespace?

CodePudding user response:

reference 5 floor wqq686868 reply:
hello, the inside of the vector class methods show that does not exist, I'm using the WPF, which is the vector should be namespace?


Sorry, little compress a file
 
Using System;
Using System. Drawing;

Public struct Vector
{
Double _x _y;

Public Vector (double x, double y)
{
_x=x; _y=y;
}
Public Vector (PointF pt)
{
_x=pt. X;
_y=pt. Y;
}
Public Vector (PointF st, PointF end)
{
_x=end. X - st. X;
_y=end. - st. Y Y;
}

Public double X
{
The get {return _x. }
The set {_x=value; }
}

Public double Y
{
The get {return _y; }
The set {_y=value; }
}

Public double Magnitude
{
The get {return math.h Sqrt (X * * Y X + Y); }
}

Public static Vector operator + (Vector v1, Vector v2)
{
Return new Vector (v1) X + v2) X, v1, Y + v2. Y);
}

Public static Vector operator - (Vector v1, Vector v2)
{
Return the new Vector (v1) X-ray v2) X, v1. The Y - v2. Y);
}

Public static Vector operator - (Vector v)
{
Return the new Vector (- v.X - v.Y);
}

Public static Vector operator * (double c, the Vector v)
{
Return the new Vector (v.X c * and c * v.Y);
}

Public static Vector operator * (Vector v, double c)
{
Return the new Vector (v.X c * and c * v.Y);
}

Public static Vector operator/(Vector v, double c)
{
Return the new Vector (, v.Y v.X/c/c);
}

Public double CrossProduct (Vector v)
{
Return v.Y - v.X _x * * _y;
}

Public double DotProduct (Vector v)
{
Return v.X + _y _x * * v.Y;
}

Public static bool IsClockwise (PointF pt1, PointF pt2, PointF pt3)
{
The Vector V21=new Vector (pt2, pt1);
The Vector v23=new Vector (pt2, pt3);
Return V21. CrossProduct (v23) & lt; 0;
}

Public static bool IsCCW (PointF pt1, PointF pt2, PointF pt3)
{
The Vector V21=new Vector (pt2, pt1);
The Vector v23=new Vector (pt2, pt3);
Return V21. CrossProduct (v23) & gt; 0;
}

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • C#
  • Related