473,385 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Does Direct3D overload System.Math??

Ark
Hi everyone,

Does anyone know if Direct3D overloads System.Math
functions?

Also is it possible to access the base functions of the
overloaded function (in other words restore original of
the overlaoded function)?

Thank you

ARK
Nov 15 '05 #1
5 2231
Hi Ark,

I believe "overload" should read "override". If this is so, you cannot alter
how the method is implemented in the base class - you can only provide
alternative implementation in the inherited one. So, if you need to access
the base implementation, just up-cast a reference to the System.Math type
and use the up-casted reference to invoke the methods.

Still, as far as I remember, the Math methods are mostly static and
therefore cannot be overridden. Direct3D provides its own subset of math
functions for matrices and vectors - but it's unlikely they have something
to do with the .NET's System.Math.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Ark" <ar*@centras.lt> wrote in message
news:08****************************@phx.gbl...
Hi everyone,

Does anyone know if Direct3D overloads System.Math
functions?

Also is it possible to access the base functions of the
overloaded function (in other words restore original of
the overlaoded function)?

Thank you

ARK


Nov 15 '05 #2
Ark <ar*@centras.lt> wrote:
Does anyone know if Direct3D overloads System.Math
functions?

Also is it possible to access the base functions of the
overloaded function (in other words restore original of
the overlaoded function)?


It's fairly unclear what you're meaning here - could you give an
example, indicating why you think Direct3D is altering System.Math
behaviour? It sounds unlikely to me.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #3
Hi Dmitriy and everyone,

Thank you for your prompt reply. Can you please give me an example of
how to up-cast the methods as you described in your reply?

Here is a more detailed description of the problem I am experiencing. I
wrote and application that uses Direct3D to render the mechanism. To
drive the mechanism i use complex 6D numerical algorithm that uses
System.Math to get solutions. Both graphical and mathematical parts work
fine separately. However when i want to run graphical interface and
numerical engine in parallel in a single application I get the following
problem:

The System.Math starts to behave in a wired way, round function does not
work well/at all. If I try to round to two decimal places, it rounds to
13, when I try to print the rounded number to console it prints the
number with 13 decimal places rather than two. Also the actual math is
performed at a very slow rate.
If I can compile both applications separately ( as independent
executables) all works fine, simultaneously.

I tired to backtrack what causes the problem, and apparently the problem
comes once create the d3d device is executed:

// Create the device
device = new Device(graphicsSettings.AdapterOrdinal,
graphicsSettings.DevType, windowed ? RenderTarget : this , createFlags,
presentParams);

To write Direct3D engine, i directly adopted example 'Enhanced Mesh'
provided by DirectXSDK.

I think something happens to memory or to resources, but not sure about
it. Even if i dipose the device after it was created the problem is
still present. Also when I move the mouse over the function Round (after
typing Math.) it say in part of the hint text +3 overloads. So my
suspicion is that direct3d in some way affects system math and that some
functions are executed in different way.

Any ideas what is going wrong here, or how to easily isolate the two
parts to avoid all this?

Thanks,

ARK
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #4
"Ark" wrote:
Hi everyone,

Does anyone know if Direct3D overloads System.Math
functions?

Also is it possible to access the base functions of the
overloaded function (in other words restore original of
the overlaoded function)?

Thank you

ARK


Haven't encountered that untill now. Even if it does, it only can
overload the method with different parameters or hide it in a derived
class. This is because System.Math is a class with static members and
not a namespace. Both would be visible to you right away by the new
class scope. So a call to System.Math.Acos will go exactly to that
method.
HTH,
Andy

--
To mail me directly, remove the NO*SPAM parts in
NO***********@gmx.netNO*SPAM
Nov 15 '05 #5
I haven't heard of or seen this behavior before but I do know that the
default behavior of DirectX is to change the floating point precision.
Could this be part of your problem?

--

Lynn Harrison
SHAMELESS PLUG - Introduction to 3D Game Engine Design (C# & DX9)
www.forums.Apress.com

"Andreas Müller" <me@privacy.net> wrote in message
news:bn*************@ID-83644.news.uni-berlin.de...
"Ark" wrote:
Hi everyone,

Does anyone know if Direct3D overloads System.Math
functions?

Also is it possible to access the base functions of the
overloaded function (in other words restore original of
the overlaoded function)?

Thank you

ARK


Haven't encountered that untill now. Even if it does, it only can
overload the method with different parameters or hide it in a derived
class. This is because System.Math is a class with static members and
not a namespace. Both would be visible to you right away by the new
class scope. So a call to System.Math.Acos will go exactly to that
method.
HTH,
Andy

--
To mail me directly, remove the NO*SPAM parts in
NO***********@gmx.netNO*SPAM

Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: some one | last post by:
I know that C++ lets you overload functions, but how do I overload functions in C?
1
by: Jon Rea | last post by:
I have an MDI application that has multiple different "modular documents". Each document can own multiple MDI windows that are managaed by a manager class that uses the singleton pattern and holds...
11
by: Nick | last post by:
This is really starting to piss me off. Someone please prove me wrong. Here is a link to the function in DX 9 sdk....
4
by: JuLiE Dxer | last post by:
Perhaps, I skipped over learning this particular tidbit. I ran across an odd error while trying to add to ushort variables together and assigning it to a 3rd ushort variable. I get this...
2
by: Lee Swanson | last post by:
Hi, I am trying to run a Direct3D tutorial, namely "hello teapot": http://www.gotdotnet.com/team/directx/learn/tutorials/helloteapot.aspx Unfortunately I am getting the following error when I...
1
by: Jack | last post by:
This sample comes from CMultiAnim sample application found in DXSDK HRESULT CMyView::InitDeviceObjects() { CMultiAnimAllocateHierarchy AH; AH.SetMA(&m_Lorry); m_Lorry.Setup (m_pd3dDevice,...
13
by: Michael McNeil Forbes | last post by:
I would like to write a module that provides some mathematical functions on top of those defined in math, cmath etc. but I would like to make it work with "any" type that overloads the math...
0
by: walve_wei | last post by:
<1>use the D3D control panel, enable the debug DLL and maximum validation,for D3D control panel ,you need to install the directx sdk. <2>Start up the debug monitor (<MSVC install...
0
by: Jameson | last post by:
ok... This isn't working, and I dont know why, when I pass the resulting surface to StretchRectangle I get the awsome "error in application" haha... anyway. Is this not the right way (using...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.