Does Direct3D overload System.Math??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ark

    Does Direct3D overload System.Math??

    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
  • Dmitriy Lapshin [C# / .NET MVP]

    #2
    Re: Does Direct3D overload System.Math??

    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

    Bring the power of unit testing to VS .NET IDE

    "Ark" <ark@centras.lt > wrote in message
    news:086701c39b d7$aa81c0d0$a30 1280a@phx.gbl.. .[color=blue]
    > 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[/color]

    Comment

    • Jon Skeet [C# MVP]

      #3
      Re: Does Direct3D overload System.Math??

      Ark <ark@centras.lt > wrote:[color=blue]
      > 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)?[/color]

      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 - <skeet@pobox.co m>
      Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

      If replying to the group, please do not mail me too

      Comment

      • Ark Nikonovas

        #4
        Re: Does Direct3D overload System.Math??

        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(graphics Settings.Adapte rOrdinal,
        graphicsSetting s.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!

        Comment

        • Andreas Müller

          #5
          Re: Does Direct3D overload System.Math??

          "Ark" wrote:
          [color=blue]
          > 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[/color]

          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.Aco s will go exactly to that
          method.
          HTH,
          Andy

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

          Comment

          • Lynn Harrison

            #6
            Re: Does Direct3D overload System.Math??

            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)


            "Andreas Müller" <me@privacy.net > wrote in message
            news:bnj2it$11e d9t$1@ID-83644.news.uni-berlin.de...[color=blue]
            > "Ark" wrote:
            >[color=green]
            > > 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[/color]
            >
            > 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.Aco s will go exactly to that
            > method.
            > HTH,
            > Andy
            >
            > --
            > To mail me directly, remove the NO*SPAM parts in
            > NO*SPAMxmen40@g mx.netNO*SPAM[/color]


            Comment

            Working...