当前位置: 首页>>代码示例>>C++>>正文


C++ Matrix::GetData方法代码示例

本文整理汇总了C++中Matrix::GetData方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix::GetData方法的具体用法?C++ Matrix::GetData怎么用?C++ Matrix::GetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Matrix的用法示例。


在下文中一共展示了Matrix::GetData方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: printf

void Matrix<real>::AppendColumns(const Matrix<real> & columns)
{
  if (columns.Getm() != m)
  {
    printf("Error: mismatch in number of rows in AppendColumns.\n");
    throw 41;
  }

  data = (real*) realloc (data, sizeof(real) * (m * (n + columns.Getn())));
  memcpy(&data[ELT(m, 0, n)], columns.GetData(), sizeof(real) * m * columns.Getn());
  n += columns.Getn();
}
开发者ID:RainVector,项目名称:LearnOpenGL,代码行数:12,代码来源:matrix.cpp

示例2: Triangle

void Render::Triangle(const CGUL::Vector2& position, const CGUL::Vector2& pointA, const CGUL::Vector2& pointB, const CGUL::Vector2& pointC, const CGUL::Color& color)
{
    using namespace CGUL;

    if (doNotDraw)
    {
        return;
    }

    Matrix model;
    model = model * Matrix::MakeTranslation(position);
    GL::UniformMatrix4fv(GL::GetUniformLocation(shaderProgram, "modelMatrix"), 1, false, model.GetData());
    GL::Uniform4f(GL::GetUniformLocation(shaderProgram, "color"), color);
    GL::Uniform1i(GL::GetUniformLocation(shaderProgram, "shaderType"), 1);
    CGUL::Vector2 positions[3] = { pointA, pointB, pointC };
    GL::Uniform2fv(GL::GetUniformLocation(shaderProgram, "positions"), 3, positions);
    GL::BindVertexArray(vertexArrayTriangle);
    GL::DrawArrays(GL_TRIANGLES, 0, 3);
    GL::BindVertexArray(0);
    GL::Uniform1i(GL::GetUniformLocation(shaderProgram, "shaderType"), 0);
}
开发者ID:JoshuaBrookover,项目名称:Physics2D,代码行数:21,代码来源:Render.cpp

示例3: Line

void Render::Line(const CGUL::Vector2& start, const CGUL::Vector2& end, const CGUL::Color& color)
{
    using namespace CGUL;

    if (doNotDraw)
    {
        return;
    }

    Matrix model = Matrix::Identity();
    GL::UniformMatrix4fv(GL::GetUniformLocation(shaderProgram, "modelMatrix"), 1, false, model.GetData());
    GL::Uniform4f(GL::GetUniformLocation(shaderProgram, "color"), color);
    GL::Uniform1i(GL::GetUniformLocation(shaderProgram, "shaderType"), 1);
    CGUL::Vector2 positions[2] = { start, end };
    GL::Uniform2fv(GL::GetUniformLocation(shaderProgram, "positions"), 2, positions);
    GL::BindVertexArray(vertexArrayLine);
    GL::DrawArrays(GL_LINES, 0, 2);
    GL::BindVertexArray(0);
    GL::Uniform1i(GL::GetUniformLocation(shaderProgram, "shaderType"), 0);
}
开发者ID:JoshuaBrookover,项目名称:Physics2D,代码行数:20,代码来源:Render.cpp

示例4: Circle

void Render::Circle(const CGUL::Vector2& position, CGUL::Float32 radius, CGUL::Float32 orientation, const CGUL::Color& color)
{
    using namespace CGUL;

    if (doNotDraw)
    {
        return;
    }

    Matrix model;
    model = model * Matrix::MakeScaling(Vector2(radius, radius));
    model = model * Matrix::MakeRotation(orientation);
    model = model * Matrix::MakeTranslation(position);
    GL::UniformMatrix4fv(GL::GetUniformLocation(shaderProgram, "modelMatrix"), 1, false, model.GetData());
    GL::Uniform4f(GL::GetUniformLocation(shaderProgram, "color"), color);
    GL::BindVertexArray(vertexArrayCircle);
    GL::DrawArrays(GL_TRIANGLE_FAN, 0, circlePrecision + 2);
    GL::BindVertexArray(0);
}
开发者ID:JoshuaBrookover,项目名称:Physics2D,代码行数:19,代码来源:Render.cpp

示例5: Box

void Render::Box(const CGUL::Vector2& position, const CGUL::Vector2& size, CGUL::Float32 orientation, const CGUL::Color& color)
{
    using namespace CGUL;

    if (doNotDraw)
    {
        return;
    }

    Matrix model;
    model = model * Matrix::MakeScaling(size);
    model = model * Matrix::MakeRotation(orientation);
    model = model * Matrix::MakeTranslation(position);
    GL::UniformMatrix4fv(GL::GetUniformLocation(shaderProgram, "modelMatrix"), 1, false, model.GetData());
    GL::Uniform4f(GL::GetUniformLocation(shaderProgram, "color"), color);
    GL::BindVertexArray(vertexArrayBox);
    GL::DrawArrays(GL_QUADS, 0, 4);
    GL::BindVertexArray(0);
}
开发者ID:JoshuaBrookover,项目名称:Physics2D,代码行数:19,代码来源:Render.cpp

示例6: Sprite

void Render::Sprite(CGUL::UInt32 texture, const CGUL::Vector2& position, const CGUL::Vector2& size)
{
    using namespace CGUL;

    if (doNotDraw)
    {
        return;
    }

    Matrix model;
    model = model * Matrix::MakeScaling(size);
    model = model * Matrix::MakeTranslation(position);
    GL::UniformMatrix4fv(GL::GetUniformLocation(shaderProgram, "modelMatrix"), 1, false, model.GetData());
    GL::Uniform1i(GL::GetUniformLocation(shaderProgram, "shaderType"), 2);
    GL::Uniform1i(GL::GetUniformLocation(shaderProgram, "texture"), 0);
    GL::ActiveTexture(GL_TEXTURE0);
    GL::BindTexture(GL_TEXTURE_2D, texture);
    GL::BindVertexArray(vertexArraySprite);
    GL::DrawArrays(GL_QUADS, 0, 4);
    GL::Uniform1i(GL::GetUniformLocation(shaderProgram, "shaderType"), 0);
    GL::BindVertexArray(0);
}
开发者ID:JoshuaBrookover,项目名称:Physics2D,代码行数:22,代码来源:Render.cpp

示例7: GetPosition


//.........这里部分代码省略.........
					current_dist_it = dist_it;
					i++;
					break;
				}
				else
				{
					continue;
				}
			}
		}


		number_of_satellites = i;
		G.SetSize(number_of_satellites, 4);
		dr.SetSize(number_of_satellites, 1);
		W.SetSize(number_of_satellites, number_of_satellites);

		for (int k = 0; k < number_of_satellites; k++)
		{
			for (int l = 0; l < number_of_satellites; l++)
			{
				W.SetData(0.0L, l, k);
			}
		}
		// Create Observation matrix
		for (i = 0; i < number_of_satellites; i++)
		{
			r = satellites[i].Distance(position);
			ENU_Frame enu(satellites[i], position);
			G.SetData(-enu.GetE()/r, i, 0);
			G.SetData(-enu.GetN()/r, i, 1);
			G.SetData(-enu.GetU()/r, i, 2);
			G.SetData(1.0, i, 3);

			dr.SetData(original_distance[i] + clockdiff[i] * IS_GPS_200::C_velocity - r - receiver_clockdiff, i, 0);

			W.SetData(sat_weight[i], i, i);

			if (j > 3)
			{
				long double atomospheric_delay = TropoSphere::GetTropoSphereCollection(satellites[i], position);
				if (ionosphere.IsValid())
				{
					atomospheric_delay += ionosphere.GetIonoSphereDelayCorrection(satellites[i], position, current);
				}
				else
				{
					// Do nothing
				}
				dr.SetData(dr.GetData(i, 0) + atomospheric_delay, i, 0);
			}
		}

		Matrix Gt = G.Tranposed();
		Matrix Gtdr = Gt * dr;

		Gaussian_Elimination gauss;

		Matrix GtGd;

		if (j == 1)
		{
			GtGd = Gt;
		}
		else
		{
			GtGd = Gt * W;
		}

		Matrix GtG = GtGd * G;
		if (j == 1)
		{
			cov = gauss.GetAnswer(GtG, Gtdr);
		}
		else
		{
			gauss.GetAnswer(GtG, Gtdr);
		}

		position= ENU_Frame(Gtdr.GetData(0, 0), Gtdr.GetData(1, 0), Gtdr.GetData(2, 0), WGS84_Frame(position)).GetPosition();


		receiver_clockdiff += Gtdr.GetData(3, 0);

		diff = ECEF_Frame(Gtdr).Distance(ECEF_Frame(0, 0, 0));

		if (j > calc_pos::max_loop)
		{
			break;
		}
		else
		{
			//Do nothing
		}
		j++;
	}

	ReceiverOutput ret = ReceiverOutput(modifiedCurrent, position, psudodistance, cov, type);
	return ret;
}
开发者ID:bunbun042000,项目名称:RINEXanalyzer,代码行数:101,代码来源:Calculate_Position.cpp


注:本文中的Matrix::GetData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。