Click here to Skip to main content
16,021,211 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have the parameters of diamonds are Diameter, girdle, crown angle, crown height, bottom angle(pavilion angle), table diameter.

i want to draw a diamond using this parameters. I am drawing diamond using points. where i have defined start point. and after i have ++ and -- the value of points to draw diamond. currently i am not using these parameters to draw diamond but i want to draw diamond using the parameters, in short i want to change the size of the diamond using the parameters. in form load event i have currently assigned the static parameters.

GlobalManagement.Instance.objDiamond.Diameter = 1.37;
     GlobalManagement.Instance.objDiamond.CrownAngle = 34.31;
     GlobalManagement.Instance.objDiamond.CrownHeight = 10.00;
     GlobalManagement.Instance.objDiamond.BottomAngle = 41.00;
     GlobalManagement.Instance.objDiamond.Girdle = 3.60;
     GlobalManagement.Instance.objDiamond.Table = 70.69;



i dont know more how to draw using these parameters.
Screenshot-11 hosted at ImgBB — ImgBB[^]

What I have tried:

 private void icVideo_OverlayUpdate(object sender, ICImagingControl.OverlayUpdateEventArgs e)
        {
            try
            {
                this.ob = e.overlay;
                this.CentX = this.icVideo.Width / 2;
                this.CentY = this.icVideo.Height / 2;
                this.ob.DropOutColor = System.Drawing.Color.Magenta;
                this.ob.Fill(System.Drawing.Color.Magenta);
                this.ob.Enable = true;
                this.ob.FontBackColor = this.ob.DropOutColor;
                this.ob.FontTransparent = false;
                bool bdrawgraph = true;
int x0_2 = 12;
                int y0_2 = 10;
                this.ob.Font = new Font("Arial", 10f, FontStyle.Bold);
                this.ob.DrawText(System.Drawing.Color.Yellow, x0_2, y0_2, "Diameter : " + GlobalManagement.Instance.objDiamond.Diameter);
                this.ob.DrawText(System.Drawing.Color.Yellow, x0_2, y0_2 + 15, "CrownAngle : " + GlobalManagement.Instance.objDiamond.CrownAngle);
                this.ob.DrawText(System.Drawing.Color.Yellow, x0_2, y0_2 + 30, "CrownHeight : " + GlobalManagement.Instance.objDiamond.CrownHeight);
                this.ob.DrawText(System.Drawing.Color.Yellow, x0_2, y0_2 + 45, "BottomAngle : " + GlobalManagement.Instance.objDiamond.BottomAngle);
                this.ob.DrawText(System.Drawing.Color.Yellow, x0_2, y0_2 + 60, "Girdle : " + GlobalManagement.Instance.objDiamond.Girdle);
                this.ob.DrawText(System.Drawing.Color.Yellow, x0_2, y0_2 + 75, "Table : " + GlobalManagement.Instance.objDiamond.Table);

Point start = new Point(340, 374);
                Color RedPen = Color.Red;

double gird = GlobalManagement.Instance.objDiamond.Girdle;

 DrawLine(RedPen, start.X, start.Y, start.X - 57, start.Y - 79);              // \
                DrawLine(RedPen, start.X, start.Y, start.X + 57, start.Y - 79);              //   /
                DrawLine(RedPen, start.X - 57, start.Y - 79, start.X + 57, start.Y - 79);        // _
                DrawLine(RedPen, start.X - 57, start.Y - 99, start.X - 57, start.Y - 79);        // |
                DrawLine(RedPen, start.X + 57, start.Y - 99, start.X + 57, start.Y - 79);        // |
                DrawLine(RedPen, start.X - 57, start.Y - 99, start.X + 57, start.Y - 99);        // _
                DrawLine(RedPen, start.X + 57, start.Y - 99, start.X + 36, start.Y - 119);        // \
                DrawLine(RedPen, start.X - 57, start.Y - 99, start.X - 36, start.Y - 119);        // /
                DrawLine(RedPen, start.X - 36, start.Y - 119, start.X + 36, start.Y - 119);        // _


                double pixelLengthTable = Math.Sqrt(Math.Pow((start.X +36) - (start.X - 36), 2) + Math.Pow((start.Y-119) - (start.Y-119), 2));
                double pixelLengthDiameter = Math.Sqrt(Math.Pow((start.X + 57) - (start.X - 57), 2) + Math.Pow((start.Y - 99) - (start.Y - 99), 2));

                double percentageT = pixelLengthTable / Math.Max(icVideo.Width, icVideo.Height) * 100.0;
                double percentageD = pixelLengthDiameter / Math.Max(icVideo.Width, icVideo.Height) * 100.0;




            }
            catch
            {
                MessageBox.Show("Drawing Error : vg");
            }

        }
Posted
Updated 31-Mar-23 1:53am
Comments
[no name] 31-Mar-23 12:11pm    
https://learn.microsoft.com/en-us/dotnet/api/system.drawing.graphics.scaletransform?view=dotnet-plat-ext-7.0

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900