Get 2D location from 3D point - autodesk-forge

I have a THREE.Vector3 with location x, y, z of a mesh in the viewer. How can I get a corresponding 2D point on canvas? I would like to place something x, y at the same location where the 3D model is located in the viewer.

Check the worldToClient(point) method (part of Autodesk.Viewing.Viewer3D), the point parameters is a THREE.Vector3 point in world space coordinates. Below is a piece of the documentation.
Calculates the pixel position in client space coordinates of a point
in world space. See also clientToWorld().

Related

How do I estimate 3D position of an object in video?

I want to find a 3D position coordinates (X, Y, Z) of a moving object.
I have a training set of pictures (frames from video) with a known ground truth XYZ position of an object.
The goal is to detect the object in the the input video and draw overlay with bounding edges and XYZ coordinates in real time 30fps.
Video stream is captured from a single fixed camera. Camera axis are not aligned with a world coordinate system (it's tilted and rotated). There will be maximum one object in a frame.
Is there existing models that can do it? Where can i start from?

How to find out the location of x,y,z from every corner of the building?

Is there a method from Autodesk Forge to find out the location of each point from the corner of the building like the picture I attached?
In the context of Forge Model Derivative & Viewer, the geometries have been translated to mesh (triangles). It does not contain the information of face/edge, which means it does not tell which is corner of the shape. you may have to calculate which is the furthest vertex. This is a blog about how to get vertex
https://forge.autodesk.com/blog/show-mesh-triangles-data-hittest

How do I create a Sales Territory map with location detection using Google Maps?

I would like to divide the world map into territories.
My area data is in the form of country names, state names, counties and zip codes.
I'm planning to use Google Maps API, unless there is a better tool.
How do I define these areas? Do I use an overlay? Can my disparate geo data be combined into overlays?
Once I have these areas defined how do I take a location and check what territory it's in?
So far I have only collected the data defining the territories and researched "Sales Area Maps" and custom maps online.
The GoogleMaps itself is a fragment. You can have Shapes overlay inside your Map Fragment.
I am giving some ideas on how you can define the territory.
1) Using Bbox (Boundary box) -- This is a cube. You define metacenter of this cube. You provide the diagonal length. You create a function to create a Bbox cube. Each time you compare your points with that Bbox's metacenter (X,Y,Z). If your point is greater than all lowest X1, Y1, Z1 and smaller than all highest X2, Y2, Z2 then you are inside that territory. Here, (X1, Y1, Z1) are the Geo coordinates of the lowest corner of you territory Bbox, and (X1, Y1, Z1) are the Geo coordinates of the highest corner of your territory bobox.
USGS uses this concept to define the territory. Here is the link:
https://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php
2) Since you already said, your territory is based on States, city names. The BBOX does not seem to work here in your scenario. So, you have to define your own custom territory. You can use reverse geo coder API to get some set of geo-coordinates. Then, you using those set of Geo coordinates, draw a Shapes using Polygon. Below gives you how you can draw custom Shapes (custom territory).
https://developers.google.com/maps/documentation/javascript/shapes#polylines
After you draw your custom area (territory), you now remained to check how a marker (a location) belongs to that territory or not?
Ans: find two each point that draws a straight line between two geo-coordinates. For instance, if you use 10 geo-coordinates to draw a Shape, you can have a pair of geo-coordinates {(coordinate 1, coordinate 6), (coordinate 2, coordinate 7), (coordinate 3, coordinate 8), (coordinate 4, coordinate 9), (coordinate 5, coordinate 10). Now, you put these pair of coordinates in an ArrayList. To know, if your point is inside that territory, you have to iteratively compare if your point is inside that pair of coordinates in your ArrayList. For better accuracy, you have to use many geo coordinates to draw your territory. This is the way.

Function for densest sphere packing inside a sphere

I'm trying to write a function for the densest packing of identical spheres inside a spherical boundary.
I'm thinking it will be something like spherepack(c,r,n), where:
c - centre of the boundary sphere (x,y,z coordinates)
r - radius of the boundary sphere
n - number of identical spheres to be packed inside the boundary
I want the outputs to be the x,y,z coordinates of the centre of each packed sphere. Does anyone know how this could be done?
How about what you might call the 'brute force' method. ie Model what would happen if you had a pile of n unit sized spheres and just tried packing them together in every possible close-packed configuration, and then measured the smallest containing sphere for the pack. I can imagine an algorythm for that, but it is not very programatically efficient, or mathmatically beautiful. Would it have to run fast, or just get the right answer?
Unfortunately, the assumption that close packing is densest is not correct :(

Showing Coordinate Lines of a 3D earth

Here is a 3D earth made based on Three js I want to find the location of Longitude and Latitude of the currently clicked location and show the coordinate lines
What should be the strategy to define those diversion lines?
How could I map my texture to it's correct equivalent Longitude/Latitude?
Edit 1 :
My question in a simpler form:
How can I get the x, y of the pattern image which was clicked inside the sphere?