sphere

XNA or OpenGL sphere texture mapping

I'm trying to map a completly normal texture into a sphere. I can't change my texture to a wrapped one, so I need to find some mapping function. This is my vertex shader code: vec3 north = vec3(0.0, 0.0, 1.0); vec3 equator = vec3(0.0, 1.0, 0.0); vec3 northEquatorCross = cross(equator, north); vec3 vertexRay = normalize(gl_Vertex.xyz);...

Texturing error on a Sphere

I have a number of spherical longitude/latitude coordinates for points on a sphere that I need to visualize. For that purpose, I transformed the points to cartesian coordinates and built a mesh of triangles that I can render with VTK. Works so far. Now I want to use a texture for the sphere model. Therefore I transformed the spherical c...

how to draw 3d sphere?

I want to draw a 3d ball or sphere in html 5.0 canvas. I want to understand the Algorithm about how to draw 3d sphere. Who can share this with me? Thanks in advance ! ...

DirectX Sphere Texture Coordinates

I have a sphere with per-vertex normals and I'm trying to derive the texture coordinates for the object using the algorithm: U = Asin(Norm.X) / PI + 0.5 V = Asin(Norm.Y) / PI + 0.5 With a polka dot texture, I get: Here's the same object without the texture applied: The issue I'm particuarly looking at (I know there's a few) is t...

Getting x,y coordinates of a texture mapped on sphere (WPF, synch, no visualtreehelper.hittest)

Hello everyone, technology: WPF, C# pretext: I am making a game with a custom gyroscope+accelerometer device. I have a sphere that has a labyrinth map on it. The texture is mapped by a set of positions and texture coordinates generated from 3rd party. The user rotates the sphere via device trying to solve the labyrinth. question: I ...

Efficient algorithm for finding spheres farthest apart in large collection

I've got a collection of 10000 - 100000 spheres, and I need to find the ones farthest apart. One simple way to do this is to simply compare all the spheres to each other and store the biggest distance, but this feels like a real resource hog of an algorithm. The Spheres are stored in the following way: Sphere (float x, float y, float...

fast sphere-grid intersection

hi! given a 3D grid, a 3d point as sphere center and a radius, i'd like to quickly calculate all cells contained or intersected by the sphere. Currently i take the the (gridaligned) boundingbox of the sphere and calculate the two cells for the min anx max point of this boundingbox. then, for each cell between those two cells, i do a bo...

Mapping A Sphere To A Cube

There is a special way of mapping a cube to a sphere described here: http://mathproofs.blogspot.com/2005/07/mapping-cube-to-sphere.html It is not your basic "normalize the point and you're done" approach and gives a much more evenly spaced mapping. I've tried to do the inverse of the mapping going from sphere coords to cube coords and ...

Finding intersection of two spheres

Hi, Consider the following problem - I am given 2 links of length L0 and L1. P0 is the point that the first link starts at and P1 is the point that I want the end of second link to be at in 3-D space. I am supposed to write a function that should take in these 3-D points (P0 and P1) as inputs and should find all configurations of the li...

Compute bounding quad of a sphere with vertex shader

I'm trying to implement an algorithm from a graphics paper and part of the algorithm is rendering spheres of known radius to a buffer. They say that they render the spheres by computing the location and size in a vertex shader and then doing appropriate shading in a fragment shader. Any guesses as to how they actually did this? The po...

Points, Lines, and Polygons on Spheres with C/C++

My application is to represent shapes on the Earth's (using a sphere is sufficient) surface. Those can be points, lines, and polygons. Coordinates should be defined by using degrees or radians (just like geographic coordinates). A (straight) line for example should be defined by two coordinates and use the great circle (http://en.wiki...

Great Circle & Rhumb line intersection

I have a Latitude, Longitude, and a direction of travel in degrees true north. I would like to calculate if I will intersect a line defined by two more Lat/Lon points. I figure the two points defining the line would create my great circle and my location and azimuth would define my Rhumb line. I am only interested in intersections tha...

Anyone know were i could find an algorithm or have a algorithm they could share to split a sphere (mesh) into random parts?

I have a list a vertices and a list of triangles. I'd like to split this single mesh into, say 5, randomly shaped meshes. When the 5 randomly shaped meshes are in place the sphere should all line up and look like 1 solid mesh. I need a algorithm to do this programmatically, not a tool to do it form me. Any pointers would be great! ...

3D Sphereical Terrain with an 8 mesh sphere. The edges of the mesh are obvioulsy seen and I'm not sure why.

Hi :) I'm working in Unity3D, but my issue is with 3D meshes. I'm hoping someone here can help or point me in the right direction. I have 2 version of code, http://www.pasteit4me.com/695002 (old) and http://www.pasteit4me.com/690003 (new). The old code, makes a single mesh sphere and creates a terrain on it. The new code makes an 8...

Minimum bounding rectangle of a circle on a sphere

What R packages are available to calculate the minimum bounding box for a great circle? For example: box <- polycirc( c( longitude, latitude ), distance=35 ) This would return the bounding box for the circle with a radius of 35 kilometres from the central point at the given coordinates (on Earth). Where: box.longitude_min = The l...

Sphere - sphere collision detection -> reaction

Hi guys, I need to make an algorithm that detects when two spheres collide, and, the direction that wich one will take an instant after the collision. Let say, Imagine like when you open your table in a pool match, all the balls are colliding one to another "randomly". So, before starting to write the code myself, I was thinking if th...

How to generate a net on a 8-dimensional sphere

Using Matlab, how to generate a net of 3^10 points that are evenly located (or distributed) on the 8-dimensional unit sphere? Thanks for any helpful answers! ...

Lighting inside of a sphere?

I have this question in mind: I need to make a scene that looks like a real sky. My first idea was to make a cube and texturize it. It wasn't that good looking. I came up with the idea of using a sphere. But I couldn't light it from inside. I've put the camera on the origin watching (0,0,-100). Ambient and specular light source also at t...

How to utilize Level Of Detail when the heightmap is unknown.

We are developing a Google Earth like application and we are tring to utilize a Spherical View-Dependent (Adaptive) LOD method. Before the details I need to mention two things: We are using a Quad-Tree containing the tiles. (a regular subdivision method is applied) The tiles acquire their height values as they are generated....

finding the intersection of 3 spheres

im trying to find the intersection of 3 spheres in space but the problem is i need to use this math in a code which will have the x and y intercepts fixed but leave the z intercept a variable. for example: (x+6)^2 + (y+3.464102)^2 + (z-j)^2 = 12^2 (x-6)^2 + (y+3.464102)^2 + (z-k)^2 = 12^2 x^2 + (y-6.928203)^2 + (z-l)^2 = 12^2 any ...