Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 3rd, 2005, 11:04 PM
Authorized User
 
Join Date: May 2005
Location: , , .
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default Graphics Math Functions

for example f(x)=x^2
or f(x)=sin(x)
where do i start? I know how to draw basic shapes on a form but i have no idea how to draw a function that is not a straight line. Thanks for any future help.


~~~~~~~~~~~~~~~~~~~~~
I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter.
__________________
~~~~~~~~~~~~~~~~~~~~~
I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter.
  #2 (permalink)  
Old December 7th, 2005, 04:45 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Over the span of the function, calculate the values incrementally. Armed with the results, draw lines or points representing them shifted incrementally to the right per incrementation, and elevated in the Y according to the value.
  #3 (permalink)  
Old January 1st, 2006, 11:06 AM
Registered User
 
Join Date: Jan 2006
Location: Bechar, N/A, Algeria.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

There is what the yur response look like

Public function MyFunc(Byval x as Double) as double
    If Not(x.IsNaN) Then
      Return(Math.sin(x))
    else
      Return(Double.IsNaN)
    endif
end function


Public Sub DrawValue()
   Dim y as Double = 0D
   Dim z as Double = 0D
    Dim g as Graphics = Form1.CreatGraphics()
    For x as Integer=0 To 100
       y=CDbl(Math.PI*x)
       z=MyFunc(y)
       g.DrawLine(Pen.Black, Xx, Yy, y, z)
    Next
end Sub



MTOMY


Similar Threads
Thread Thread Starter Forum Replies Last Post
Math Functions on dynamic data jroxit Classic ASP Basics 3 January 23rd, 2007 12:07 PM
Getting percentages with math functions tslag XSLT 1 June 22nd, 2006 11:47 AM
Math question dparsons ASP.NET 1.0 and 1.1 Professional 5 June 14th, 2006 02:31 PM
Math functions-Please help! jroxit ASP.NET 2.0 Basics 5 December 28th, 2005 12:21 PM
Why are my math functions not being included? jkeen BOOK Beginning Linux Programming, 3rd Edition 4 October 22nd, 2004 05:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.