Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8177515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:31:46+00:00 2026-06-06T23:31:46+00:00

How can I translate this C++ code snippet into C# ? void fm_getAABB(…, const

  • 0

How can I translate this C++ code snippet into C# ?

void fm_getAABB(..., const float *points, ...)
{    
   // ...
   const unsigned char *source = (const unsigned char *) points;
   //...    
   const float *p = (const float *) source;
   //...
}

I’ve already tried to use a C++ to C# converter, but it doesn’t seem able to translate it either.

EDIT:
Here’s the whole function:

void fm_getAABB(unsigned int vcount, const float *points, unsigned int pstride,
    float *bmin, float *bmax)
{
    const unsigned char *source = (const unsigned char *) points;

    bmin[0] = points[0];
    bmin[1] = points[1];
    bmin[2] = points[2];

    bmax[0] = points[0];
    bmax[1] = points[1];
    bmax[2] = points[2];

    for (unsigned int i = 1; i < vcount; i++)
    {
        source+=pstride;
        const float *p = (const float *) source;

        if ( p[0] < bmin[0] ) bmin[0] = p[0];
        if ( p[1] < bmin[1] ) bmin[1] = p[1];
        if ( p[2] < bmin[2] ) bmin[2] = p[2];

        if ( p[0] > bmax[0] ) bmax[0] = p[0];
        if ( p[1] > bmax[1] ) bmax[1] = p[1];
        if ( p[2] > bmax[2] ) bmax[2] = p[2];
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:31:47+00:00Added an answer on June 6, 2026 at 11:31 pm

    One option is to translate this as-is, by using the unsafe mode of C#. C# is perfectly capable of running this code with small modifications. You need to remove the const modifier for example.

    If you manage to produce a managed-only version that would be preferable of course. But it is not entirely clear that that is even possible: Your function is performing certain pointer manipulations which might lead to unaligned access. Managed arrays cannot pe accessed in an unaligned way using managed-only features.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I translate this pseudo code into working JS [don't worry about where
Please can anyone translate this python code into javascript. # def strip_punctuation(s): # for
how i can translate this code into razor syntax: <% for (int i =
Can someone please translate this high-level code into IA-32 assembly without using any global
I am trying to translate this centering code snip in Objective-C into MonoTouch imageView.frame.origin.x
Considering this code fragment: struct My { operator const char*()const{ return my; } }
How can I translate this Java code: private List<MPoint> classes = new ArrayList<MPoint>(); //
I am trying to translate the VBA code found in this link into IronPython.
I'm trying to translate the c++ code and i can't work out what char
Can someone help me translate this to CLR code: <ContentControl Content={Binding} />

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.