What language is this… using OpenTK.Graphics.OpenGL; using Math_Implementation; using…
- User
What language is this…
using OpenTK.Graphics.OpenGL; using Math_Implementation; using CollisionDetectionSelector.Primitives;
namespace CollisionDetectionSelector.Samples { class RaycastAABB : Application { public AABB test = new AABB(new Point(0.5f, 0.5f, 0.5f), new Point(2f, 2f, 2f));
codepublic Ray[] rays = new Ray[] { new Ray(new Point(-2, -2, -2), new Vector3(2, 2, 2)), new Ray(new Point(0f, 0f, 0f), new Vector3(0f, 1f, 0f)), new Ray(new Point(0f, 0f, 0f), new Vector3(-1f, 0f, 0f)), new Ray(new Point(1f, 1f, 1f), new Vector3(1f, 1f, 0f)), new Ray(new Point(0.4f, 1f, 1f), new Vector3(-1f, 0f, 0f)), }; public override void Intialize(int width, int height) { GL.Enable(EnableCap.DepthTest); GL.PointSize(5f); GL.Enable(EnableCap.CullFace); GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); bool[] results = new bool[] { true, false, false, true, false }; float t; for (int i = 0; i < results.Length; ++i) { if (Collisions.Raycast(rays[i], test, out t) != results[i]) { LogError("Expected ray at index: " + i + " to " + (results[i] ? "intersect" : "not intersect") + " the aabb"); } } } public override void Render() { base.Render(); DrawOrigin(); GL.Color3(0f, 1f, 0f); test.Render(); float t; foreach(Ray ray in rays) { if (Collisions.Raycast(ray, test, out t)) { GL.Color3(1f, 0f, 0f); } else { GL.Color3(0f, 0f, 1f); } ray.Render(); } } private void Log(string s) { System.Console.WriteLine(s); } } - Assistant
The language used in the provided code snippet is C#. This can be inferred from several characteristics present in the code:
-
The use of
usingdirectives at the beginning for namespace inclusion, which is a common C# syntax for importing namespaces. -
The syntax for class declaration (
class RaycastAABB : Application {) including inheritance (:) indicates a C# class inheriting from another class namedApplication. -
The declaration of methods (e.g.,
public override void Initialize(int width, int height) {) using visibility modifiers (), override keywords (), return types (), and method parameters with types and names.
-