ofxRay | Lightweight Ray class and operations for openFrameworks

 by   elliotwoods C++ Version: Current License: No License

kandi X-RAY | ofxRay Summary

kandi X-RAY | ofxRay Summary

ofxRay is a C++ library. ofxRay has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

A lightweight set of tools for intersection testings (e.g. does a ray intersect a plane).
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              ofxRay has a low active ecosystem.
              It has 65 star(s) with 19 fork(s). There are 6 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 3 open issues and 3 have been closed. On average issues are closed in 133 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of ofxRay is current.

            kandi-Quality Quality

              ofxRay has no bugs reported.

            kandi-Security Security

              ofxRay has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              ofxRay does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              ofxRay releases are not available. You will need to build from source code and install.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ofxRay
            Get all kandi verified functions for this library.

            ofxRay Key Features

            No Key Features are available at this moment for ofxRay.

            ofxRay Examples and Code Snippets

            No Code Snippets are available at this moment for ofxRay.

            Community Discussions

            QUESTION

            Check if ofRay intersects with ofMeshFace
            Asked 2019-Apr-11 at 20:51

            I've tried many examples of code from the openframeworks forum and documentation, but I couldn't get one to do what I want.

            I have an ofRay (from ofxRay), and a list of of3dPrimitive. I am trying to figure out if the ray intersects a primitive, and if so, to know which primitive the ray intersected with "first" (as in, which one is the closest to the screen).

            ...

            ANSWER

            Answered 2017-Apr-06 at 20:53

            Assuming plenty of triangle/mesh raycasting code on the internet you have tried would have solved your problem, I think your problem is in the first method, in which you set a "found" variable, but do not return from the method if found or pick the object with min distance.

            The code you've provided will just return the last primitive's hit test result.

            If you have over-simplified your code, please post again with more detail.

            Edit:

            The coordinates you get from the mesh's faces are in object space. You need to convert them to world space before any calculations, or better, convert the ray to object space.

            See this code for a working implementation: https://github.com/mrdoob/three.js/blob/master/src/objects/Mesh.js

            Notice the applyMatrix4 calls that apply a world matrix to bring them to the same space.

            Source https://stackoverflow.com/questions/42707778

            QUESTION

            Reflecting ray on triangle in 3D space
            Asked 2017-Apr-16 at 16:26

            I am working in a 3D space. I have a ray, or more specifically the start and transmission vector of a ray in 3D space. I also have a triangle, which I know for a fact is hit by the ray. By triangle I of course mean I have three 3D points. I can also calculate a normal vector from this triangle easily.

            Now I need to get a new ray, which would be the reflection after that specific hit.

            I also don't know exacltly where on the triangle the point of contact is, but it obviously has to be taken into account to get the reflected ray. That point would be the start of that new ray.

            This is trivial to do in 2D, but I can't figure out how to do it in 3D.

            I am using C++ and OpenFrameworks with the ofxRay add-on.

            ...

            ANSWER

            Answered 2017-Apr-16 at 16:26

            This problem splits cleanly into two problems: find the point where the ray meets the triangle -- which is the point of origin of the reflected ray -- and find the direction (vector) of the reflected ray.

            Let the normal vector of the triangle be n. The equation describing the plane of the triangle is

            nx = k

            You can determine k by plugging one of the triangle vertices into that equation. The equation of the incident ray is

            x = tv + p

            where p is the point of origin of the ray, and v is its (normalized) direction. To find the point of intersection of the ray, just solve this pair of equations, which comes down to solving

            n(tv + p) = k

            for t, then plugging that back into the equation for the ray.

            To find the direction of the reflected ray, we must reverse the component of the incident ray parallel to the triangle's normal:

            vr = v + 2(vn)v

            (Watch out for the sign-- I assumed that the normal points out of the face which the ray hits.)

            Source https://stackoverflow.com/questions/43432460

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install ofxRay

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/elliotwoods/ofxRay.git

          • CLI

            gh repo clone elliotwoods/ofxRay

          • sshUrl

            git@github.com:elliotwoods/ofxRay.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link