Skip to main content
gamedev.net
🔒 Locked

C++ to Python Code

Started by Geometrian 3 replies 1.1k views
Original Post
Geometrian
Geometrian
Hi, I'm trying to make a ray-tracer, and I need to have a triangle-ray test. It needs to: If an intersection: give the location of intersection If coplanar: return True If no intersection: return False It should also be pretty fast. Every one of the examples online is in C, (or some related language). Can someone translate one of these methods? That would be great! Thanks, Geometrian
[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]
smitty1276
smitty1276
What's the problem? Have you even TRIED to look at the code and make sense of it before asking other people to do your work for you? Which code have you looked at and which parts are you not understanding?
Geometrian
Geometrian
I have looked at tons of code, and every time I try to translate it, I get stuck halfway through, arrive with a non-working or incorrectly functioning product, or get something which doesn't work at all. Furthermore, I haven't even been able to find a solution that seems to fit my requirements.

The problem is partially that I have no knowledge of C languages, and am operating just on guesswork, and also that I don't really understand the theory behind it. Maybe if I knew one or the other...

Please, I've been working on this problem for weeks, and I can't figure it out. How hard can it be to write a piece of code which does this?
[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]
smitty1276
smitty1276
You wrote the steps in your original post... why can't you just write the code in python to do it? If the problem is that you don't know HOW to intersect a ray with your scene, or determine whether points are coplanar, or something else, then I would suggest that you study some 3D theory first, because you can't possibly write a raytracer without knowing those things.

If you know those things, I don't see why you are copying c++ code... just write it yourself.
Geometrian
Geometrian
Yes, I could do that.
You're right, the problem is that I do not know how to make an effective algorithm. I'm thinking that if I had the Python code, I could figure out how it works, and what it does.
[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.