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 7583053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:35:22+00:00 2026-05-30T18:35:22+00:00

I am porting this SimplexNoise modual from C++ to C#, and have ran into

  • 0

I am porting this SimplexNoise modual from C++ to C#, and have ran into issues with the way the programmer has retrevied values from arrays. He has something like as follows:

simplexnoise.h

static const int grad3[12][3] = {
    {1,1,0}, {-1,1,0}, {1,-1,0}, {-1,-1,0},
    {1,0,1}, {-1,0,1}, {1,0,-1}, {-1,0,-1},
    {0,1,1}, {0,-1,1}, {0,1,-1}, {0,-1,-1}
};

simplesxnoise.cpp

n1 = t1 * t1 * dot(grad3[gi1], x1, y1);

And in my C# port:

SimplexNoise.cs

    private static int[][] grad3 = new int[][] { new int[] {1,1,0}, new int[] {-1,1,0}, new int[] {1,-1,0}, new int[] {-1,-1,0},
                                                 new int[] {1,0,1}, new int[] {-1,0,1}, new int[] {1,0,-1}, new int[] {-1,0,-1},
                                                 new int[] {0,1,1}, new int[] {0,-1,1}, new int[] {0,1,-1}, new int[] {0,-1,-1}};

...

    n1 = t1 * t1 * dot(grad3[gi1], x1, y1);

And for that line I get, cannot convert from int[] to int. Which is logical but how does this not have any errors in the C++ version? I only know the basics of C++ but from what I know that is an attempt to assign an integer variable with a 1D int array, which just doesn’t make any sence.

Any ideas?

  • 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-05-30T18:35:23+00:00Added an answer on May 30, 2026 at 6:35 pm

    This is because according to the source that you linked, dot() expects an array as its first argument:

    float dot(const int* g, const float x, const float y);
    

    const int* g means “a pointer to an integer”, or “an integer array”. Considering the usage, it is “an integer array” that the signature implies. Hence, you need to change the signature of your C# dot():

    float dot(int g[], float x, float y);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am porting an algorithm from C# to Ruby. This algorithm has one method
I'm porting some code from Python 2 to 3. This is valid code in
I am porting some code from C to C++ and I found this code:
We have developed Air application and next step it is porting this application to
I am getting errors when porting this map into Objective C. typedef map<uint32_t,string>EventMapType; EventMapType
I'm currently porting a pretty basic gallery application from PHP to Go. This application
I'm porting parts of Java project to C# and came across this constant Constant.NamespaceSpecNS.
This should seem simple enough, but can't figure it out. I was porting a
I'm in the process of porting some ANSI C++ code to C#... and this
Posting this one for a friend. They have an Icefaces app that uses Icefaces's

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.