質問

I want to convert a set of coordinates into polar coordinates (the easy part), and then model them on a polar 3D grid. Is this possible using WebGL or are only Cartesian coordinates supported?

役に立ちましたか?

解決

You can implement any type of coordinate transform you want in shaders. However, there is an important restriction:

If you draw two connected vertices (i.e. a straight line, or the edge of a triangle), the result will always be a straight line on the screen — it is not possible to do otherwise in OpenGL.

The Cartesian-polar transform turns straight lines into curved lines. This means that if you want to transform a straight-sided shape and get the “right” curved result, you must draw it using a sequence of closely-spaced vertices — as many as you need to produce the “resolution” of smooth curvature you want. This is generally not hard to program, but it is something to be aware of.

他のヒント

You can use shaders in webgl so you can give your inputs as polar coordinates and have webgl transform them to cartesian internally.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top