I'm writing an application where I need to be able to draw a scale random triangle. So far I've defined the max bounding rectangle (170,170) and defined random angles:
I need help drawing the maximum sized scale triangle within the bounding rectangle, using my random angles.
I also need help drawing Vertex labels (A,B,C) and side labels(a,b,c), and interior angle labels...
Any ideas on how to do this?
Code:
Public Class Form1
Dim tt() As String = {"right", "acute"}
Dim r As New Random
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'new
Dim index As Integer = r.Next(0, 2)
Dim t As New triangle
If tt(index) = "right" Then
t.angle_A = 90
t.angle_B = r.Next(15, 46)
t.angle_C = 90 - t.angle_B
ElseIf tt(index) = "acute" Then
t.angle_A = r.Next(15, 81)
t.angle_B = r.Next(15, CInt(180 - t.angle_A * 0.6) + 1)
t.angle_C = 180 - t.angle_A - t.angle_B
End If
End Sub
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
e.Graphics.DrawRectangle(Pens.Silver, New Rectangle((PictureBox1.Width - 170) \ 2, (PictureBox1.Height - 170) \ 2, 170, 170))
End Sub
End Class
Public Class triangle
Public angle_A As Decimal
Public angle_B As Decimal
Public angle_C As Decimal
Public length_a As Decimal
Public length_b As Decimal
Public length_c As Decimal
End Class
I also need help drawing Vertex labels (A,B,C) and side labels(a,b,c), and interior angle labels...
Any ideas on how to do this?