标签: projection

NDS上的gluProject?

我一直在努力解决这个问题.我正在尝试使用devKitPro确定我的NDS屏幕上模型中顶点的屏幕坐标.该库似乎实现了OpenGL的一些功能,但特别是缺少gluProject函数,这将(我假设)允许我轻松地完成.

我一直在努力尝试使用存储在DS寄存器中的投影基质来手动计算屏幕坐标,但是我没有太多运气,即使在尝试从头开始构建投影矩阵时也是如此OpenGL的文档.这是我正在尝试使用的代码:

void get2DPoint(v16 x, v16 y, v16 z, float &result_x, float &result_y)
{
 //Wait for the graphics engine to be ready
 /*while (*(int*)(0x04000600) & BIT(27))
  continue;*/

 //Read in the matrix that we're currently transforming with
 double currentMatrix[4][4]; int i; 
 for (i = 0; i < 16; i++)
  currentMatrix[0][i] = 
  (double(((int*)0x04000640)[i]))/(double(1<<12));

 //Now this hurts-- take that matrix, and multiply it by the projection matrix, so we obtain
 //proper screen coordinates.
 double f = 1.0 / tan(70.0/2.0);
 double aspect = 256.0/192.0; …
Run Code Online (Sandbox Code Playgroud)

opengl 3d homebrew projection nintendo-ds

2
推荐指数
1
解决办法
1423
查看次数

360度球体全景到Cube全景变换算法(伪代码或至少需要完整逻辑)

所以我们可以从维基百科中获取这样的图像 替代文字 并尝试将其映射为未来的立方体或类似立方体的东西 替代文字 替代文字

而不是扭曲的顶部和底部之类的 替代文字

有些人可能认为只做一半而不是试图填补它会产生分歧 替代文字

它不会=(并且内容意识填充无助于填充该方格=(

但如果你试图渲染这样的立方全景,它看起来很糟糕.

我可以想象的另一种方式是将3d全景图渲染到球体上,然后以某种方式将其快照/投影到立方体上......但我不知道如何用简单的数学运算来记录它(这里的想法是不使用渲染引擎但要尽可能以数学方式完成

algorithm projection pseudocode cube panoramas

2
推荐指数
1
解决办法
4531
查看次数

简单的3D投影和定向处理?

我正在研究一个古怪的复古飞行模拟器,我在我的3D项目中遇到了一些问题,因为我找不到关于这个主题的任何可靠的通用文档.

如何在给定以下信息的情况下将我的游戏世界中的简单位置矢量转换为屏幕上的2d矢量:

摄像机将摄像机方向(见下文)定位为视野,屏幕的高度和宽度(以及宽高比)

我也在寻找一种存储方向的方法,我已经编写了一个基本的矢量库,但我不确定如何存储用于相机(和投影代码)的旋转以及旋转的实际处理游戏中的物体.我目前正在寻找使用四元数但是它可以(并且很容易)使用四元数而不是矩阵进行投影变换?

代码中的实现四元数是否有任何好的来源?我是否必须为复数编写一个单独的库?

谢谢你的时间和任何帮助:)

3d lua projection matrix quaternions

2
推荐指数
1
解决办法
1629
查看次数

使用linq使用列表对匿名类进行投影

假设我有这些类:

public MyClass
{
   public Property1 {get; set;}
   public Property2 {get; set;}
   public Property3 {get; set;}
   public Property4 {get; set;}
   public Property5 {get; set;}
   public Property6 {get; set;}
   public Property7 {get; set;}
   public Property8 {get; set;}
   public List<MySecondClass> MyList {get; set;}
}

public MySecondClass
{
   public SecondProperty1 {get; set;}
   public SecondProperty2 {get; set;}
   public SecondProperty3 {get; set;}
   public SecondProperty4 {get; set;}
   public SecondProperty5 {get; set;}
}
Run Code Online (Sandbox Code Playgroud)

假设一切都被实例化,我将如何使用LINQ做,只是有一个投影Property1,并Property2和刚做了一个列表SecondProperty4SecondProperty5

就像是:

myClass.Select(x=> new { Property1 …
Run Code Online (Sandbox Code Playgroud)

c# linq projection

2
推荐指数
1
解决办法
3245
查看次数

使用LINQ将列表投影到键/计数二维数组

假设我有一个像这样的对象列表:

var users = new List<User>();
users.Add(new User() { FirstName = "Ek0nomik" });
users.Add(new User() { FirstName = "Ek0nomik" });
users.Add(new User() { FirstName = "Foobar" });
Run Code Online (Sandbox Code Playgroud)

我试图从该列表中获取一个二维数组,其中包含该名称的名称和计数(目的是将其作为JSON返回,并在Google Charts中使用).这是数组包含的内容:

["Ek0nomik", 2],
["Foobar", 1]
Run Code Online (Sandbox Code Playgroud)

我最初试图用来.Select投影一个新对象,但是为列表中的每个对象投影,所以我认为这种方法不会让我在那里.

c# linq arrays json projection

2
推荐指数
1
解决办法
1194
查看次数

WebGL等距投影

好吧,坚持这里.我正在做一些WebGL,我正在尝试制作一个等距立方体.我不想使用Three.js.我想首先了解我的代码中出了什么问题.我一直在研究,我能找到的唯一教程似乎是OpenGL

无论如何 - 这是我的drawScene函数:

function drawScene() {

this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.DEPTH_BUFFER_BIT);
mat4.perspective(45, this.gl.viewportWidth / this.gl.viewportHeight, 0.1, 100.0, pMatrix);
mvMatrix = mat4.lookAt([0,0,40], [0, 0, 0], [0, 1, 0]);

_globalNext = this._first;

    while(_globalNext) {
    _globalNext.render();
    }

}
Run Code Online (Sandbox Code Playgroud)

并且渲染功能是

function render() {

mvPushMatrix();

//transform. order matters.
mat4.translate(mvMatrix, [this._x, this._y, this._z]);
mat4.rotate(mvMatrix, 0.01745*this._rot, [this._axisX, this._axisY, this._axisZ]);
mat4.scale(mvMatrix,  [this._scaleX,this._scaleY,this._scaleZ]);

//bind the buffers.
this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this._positionBuff);
this.gl.vertexAttribPointer(this._shader.vertexPositionAttribute, this._positionBuff.itemSize,   this.gl.FLOAT, false, 0, 0);

this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this._colorBuff);
this.gl.vertexAttribPointer(this._shader.vertexColorAttribute, this._colorBuff.itemSize, this.gl.FLOAT, false, 0, 0);

this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this._indexBuff);
this.setMatrixUniforms(this.gl);
this.gl.drawElements(this.gl.TRIANGLES, this._indexBuff.numItems, this.gl.UNSIGNED_SHORT, 0);

    if(this._usePopper …
Run Code Online (Sandbox Code Playgroud)

projection isometric webgl

2
推荐指数
1
解决办法
4498
查看次数

python:3D表面图的2D透视投影

我正在使用matplotlib(python)制作3D表面图。我想在xy xz和yz表面上可视化3D表面的阴影(2D透视投影)

在matlab中,SHADOWPLOT完成了所需的工作。有谁知道Python是否具有类似的东西可以用于相同的东西?

python 3d projection matplotlib

2
推荐指数
1
解决办法
5418
查看次数

透视投影矩阵的说明(第二行)

我试图找出透视投影矩阵的工作原理.

根据这个:https://www.opengl.org/sdk/docs/man2/xhtml/gluPerspective.xml

f =余切(fovy/2)

从逻辑上讲,我理解它是如何工作的(x-和y-值越来越远离边界框,反之亦然),但我需要一个数学解释为什么这个有效.也许是因为相交线的定理?

我在这里找到了一个解释:http://www.songho.ca/opengl/gl_projectionmatrix.html 但我不明白它的相关部分.

opengl 3d projection matrix

2
推荐指数
1
解决办法
1757
查看次数

如何将OpenLayers 3与Proj4js一起使用

我正在开发一个地图查看器项目,并在此之前使用了openlayers 2.现在我必须使用OpenLayers 3,地图查看器应该支持许多不同的投影,因为我有来自不同来源和投影的wms和wfs图层.我找到了使用openlayers2和proj4js的示例.但我找不到使用ol3和proj4js的明确示例.你的建议是什么?

gis projection openlayers proj4js openlayers-3

2
推荐指数
1
解决办法
7108
查看次数

逆透视变换?

我试图从给定的图像中找到鸟瞰图像.我也有旋转和翻译(也是内在矩阵)将它转换成鸟瞰平面.我的目标是找到逆单应矩阵(3x3).

rotation_x = np.asarray([[1,0,0,0],
                        [0,np.cos(R_x),-np.sin(R_x),0],
                        [0,np.sin(R_x),np.cos(R_x),0],
                        [0,0,0,1]],np.float32)

translation = np.asarray([[1, 0, 0, 0],
                         [0, 1, 0, 0 ],
                         [0, 0, 1, -t_y/(dp_y * np.sin(R_x))],
                         [0, 0, 0, 1]],np.float32)

intrinsic = np.asarray([[s_x * f / (dp_x  ),0, 0, 0],
                       [0, 1 * f / (dp_y ) ,0, 0 ],
                       [0,0,1,0]],np.float32)

#The Projection matrix to convert the image coordinates to 3-D domain from (x,y,1) to (x,y,0,1); Not sure if this is the right approach
projection = np.asarray([[1, 0, 0],
                        [0, 1, 0], …
Run Code Online (Sandbox Code Playgroud)

opencv projection computer-vision homography

2
推荐指数
1
解决办法
1112
查看次数