Giter Site home page Giter Site logo

Comments (4)

conrad avatar conrad commented on August 21, 2024 1

Hi @vidaaudrey! Thanks, I'll check out the new unofficial version.

After clicking and logging out the ray for a bit, I wasn't able to determine what the point Vec3 array represents--it's value changes weren't very predictable for me. BUT what I did find was the planeIntersection method on the Ray object that did exactly what we wanted. ray.planeIntersection([0, 0, 0], [0, 0, 1]) gives me what we're looking for.

from webviz.

conrad avatar conrad commented on August 21, 2024

What I'd like to write looks like this:

  getFloor = () => {
    const vertices = [
      { x: FLOOR_LENGTH / 2, y: FLOOR_LENGTH / 2, z: 0 },
      { x: -FLOOR_LENGTH / 2, y: FLOOR_LENGTH / 2, z: 0 },
      { x: -FLOOR_LENGTH / 2, y: -FLOOR_LENGTH / 2, z: 0 },
      { x: FLOOR_LENGTH / 2, y: -FLOOR_LENGTH / 2, z: 0 },
    ]
    const floorPolygonData = [
      {
        id: 1111,
        points: vertices,
        color: WORLDVIEW_RGB.clear,
      }
    ]
    return (
      <FilledPolygons
        onClick={this.handleFloorClick}>
        {floorPolygonData}
      </FilledPolygons>
    )
  }

In this, the click event would have to get the coordinates of where on the object the click hit. Is there a way to do this?

from webviz.

vidaaudrey avatar vidaaudrey commented on August 21, 2024

Hey @conrad the onClick event does give you a ray object which contains the raycasting information including dir (direction), origin, and clicked point (all in Vec3 format). Try it out and see if satisfies your requirement.

Regarding on the performance, there is some extra computation in FilledPolygons to get the points. You could try use Triangles directly. https://github.com/cruise-automation/webviz/blob/master/packages/regl-worldview/src/commands/FilledPolygons.js#L71

In addition, Worldview 0.2.0 is unofficially available now (ref #177). It has some performance optimizations and you no longer need to pass the id in. We've been testing it internally with lots of moving objects and PointCloud. Let us know if you have any questions or still see perf drops after you try it out.

from webviz.

vidaaudrey avatar vidaaudrey commented on August 21, 2024

Great that your found a work-around. BTW, the new version is available now and here is the migration guide: https://webviz.io/worldview/#/docs/migration-notes/migrating-to-version-0.2.x

from webviz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.