Click here to Skip to main content
15,913,773 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: How to Create MySQL database and Restore in VB 6.0 Pin
Noctris8-May-09 0:08
Noctris8-May-09 0:08 
AnswerRe: How to Create MySQL database and Restore in VB 6.0 Pin
Dalek Dave8-May-09 1:13
professionalDalek Dave8-May-09 1:13 
QuestionObject Required: WScript Pin
Anoop Brijmohun7-May-09 21:03
Anoop Brijmohun7-May-09 21:03 
AnswerRe: Object Required: WScript Pin
Mycroft Holmes7-May-09 21:41
professionalMycroft Holmes7-May-09 21:41 
GeneralRe: Object Required: WScript Pin
Anoop Brijmohun7-May-09 21:55
Anoop Brijmohun7-May-09 21:55 
GeneralRe: Object Required: WScript Pin
Noctris8-May-09 0:09
Noctris8-May-09 0:09 
GeneralRe: Object Required: WScript Pin
Dave Kreskowiak8-May-09 0:41
mveDave Kreskowiak8-May-09 0:41 
QuestionHelp - a Different sort of Triangle Value Calculation Pin
cyndy_northrup7-May-09 18:05
cyndy_northrup7-May-09 18:05 
I'm looking for some help with computing values of a triangle and then drawing it to screen

Known;

Two points in degrees exist on a circle

Two line lengths representing ;

base, adjacent side (a)

and

opposite (c)

we want to derive side (b) hypotenuse

and also angles (A), (B), (C)

We already know that sides (a) and (c) join and we know that the longest side length will not exceed the diameter of the circle that the triangle is circumscribed within

The triangle created will be variable as different degrees and side lengths are entered, typically this will be scalene triangles but the may also be at times right triangles

I've been using a derived arc cos function ;

------------------------------------------------------------------------
Public Function Arccos(X As Double) As Double
Arccos = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
End Function
------------------------------------------------------------------------

I know we can convert degrees to radians via "* Pi) / 180"

I know I can get the hypotenuse by;

------------------------------------------------------------------------
side_b_squared = CDbl(c1 ^ 2 + a1 ^ 2 - (c1 * a1)) * Cos(angle_B_degree_value_radians)
b1 = Sqr(side_b_squared)
------------------------------------------------------------------------

I know we can get the angles A,B,C via ;

------------------------------------------------------------------------
angle_C_cos_value = CDbl(a1 ^ 2 + b1 ^ 2 - c1 ^ 2) / (2 * (a1 * b1))
angle_B_cos_value = CDbl(c1 ^ 2 + a1 ^ 2 - b1 ^ 2) / (2 * (c1 * a1))
angle_A_cos_value = CDbl(b1 ^ 2 + c1 ^ 2 - a1 ^ 2) / (2 * (b1 * c1))
angle_C_acos_value = (Arccos(angle_C_cos_value))
angle_B_acos_value = (Arccos(angle_B_cos_value))
angle_A_acos_value = (Arccos(angle_A_cos_value))
angle_C_degree_value = angle_C_acos_value * 180 / Pi
angle_B_degree_value = angle_B_acos_value * 180 / Pi
angle_A_degree_value = angle_A_acos_value * 180 / Pi
------------------------------------------------------------------------

Although, I've had some trouble with this since some of the returned angles for some previous testing I did didn't
seem to be working very well, for instance I'd enter 60 degrees for angle (B) but it would somehow crunch it to

angle_B_Degree Value 38.8700377933938

I'm a little stuck on the math for all this.... here is an example scenario that I hope illustrates really clearly what I'm trying to do ;

A small VB app does the following ;

A small circle is drawn to the screen

On the form of the VB app there are text boxes that accept inputs ;

Text 1 = side (c) length as a number
Text 2 = side (a) length as a number

Text 3 = a value in degrees that represents a point of one of the ends of side (c)
Text 4 = a value in degrees that represents a point of one of the ends of side (a)

Then the following are computed ;

side length of the hypotenuse as a number, and output to a different text box

Angles (A), (B), (C) are computed as values in degrees, and output to another text box

The drawn circle may be say four inches in diameter, and all side lengths computed, regardless of their number value
are fit proprotionally, circumscribed within the circle, so even if one of the side lengths is really long, all side lengths are fit proportionally in the circle but retaining the same intrinsic unit measure values of their lengths.

Any help or insights on the above are really appreciated, especially the math and formula end and any code ideas, samples are a God send.

I'm a bit of a newbie with all this and I'm using an older version of VB (4.0)

I have a basic idea on using some of the draw functions and I think I can tinker my way through this, but again am very open to any feedback

Thanks people!

Smile | :)
AnswerRe: Help - a Different sort of Triangle Value Calculation Pin
Dalek Dave7-May-09 21:25
professionalDalek Dave7-May-09 21:25 
GeneralRe: Help - a Different sort of Triangle Value Calculation Pin
cyndy_northrup8-May-09 10:18
cyndy_northrup8-May-09 10:18 
QuestionRe: Help - a Different sort of Triangle Value Calculation Pin
cyndy_northrup8-May-09 22:05
cyndy_northrup8-May-09 22:05 
QuestionHELP - Hypotenuse and Angle B Error Pin
cyndy_northrup7-May-09 18:04
cyndy_northrup7-May-09 18:04 
AnswerRe: HELP - Hypotenuse and Angle B Error Pin
Dalek Dave7-May-09 21:19
professionalDalek Dave7-May-09 21:19 
GeneralRe: HELP - Hypotenuse and Angle B Error Pin
cyndy_northrup8-May-09 10:11
cyndy_northrup8-May-09 10:11 
AnswerRe: HELP - Hypotenuse and Angle B Error Pin
Dave Kreskowiak8-May-09 0:35
mveDave Kreskowiak8-May-09 0:35 
QuestionCombo displaying font Pin
Ric70247-May-09 11:15
Ric70247-May-09 11:15 
AnswerRe: Combo displaying font Pin
Dave Kreskowiak7-May-09 14:30
mveDave Kreskowiak7-May-09 14:30 
AnswerRe: Combo displaying font Pin
DidiKunz8-May-09 1:31
DidiKunz8-May-09 1:31 
QuestionUsing print spooler to update shared log file Pin
Roy Barkas7-May-09 11:15
Roy Barkas7-May-09 11:15 
AnswerRe: Using print spooler to update shared log file Pin
Dave Kreskowiak7-May-09 14:28
mveDave Kreskowiak7-May-09 14:28 
GeneralRe: Using print spooler to update shared log file Pin
Roy Barkas7-May-09 21:48
Roy Barkas7-May-09 21:48 
GeneralRe: Using print spooler to update shared log file Pin
Dave Kreskowiak8-May-09 0:31
mveDave Kreskowiak8-May-09 0:31 
Questiondatatype conversion problem when fetching fromn database Pin
Ankit Aneja7-May-09 7:42
Ankit Aneja7-May-09 7:42 
AnswerRe: datatype conversion problem when fetching fromn database Pin
Dave Kreskowiak7-May-09 10:00
mveDave Kreskowiak7-May-09 10:00 
GeneralRe: datatype conversion problem when fetching fromn database Pin
Ankit Aneja7-May-09 11:02
Ankit Aneja7-May-09 11:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.