在DX11中缩放广告牌矩阵

时间:2018-12-07 14:30:24

标签: c++ math matrix directx rendering

我使用以下代码构建了一个广告牌矩阵:

void ModifyModel (CPX_RHLPflow &mono, DATA data) {

  char name[50];

  int cont = 0;
  for (int i = 0; i < data.n; i++) {
      for (int j = 0; j < data.n; j++) {
          if (i != j) {
              IloExpr r_1c(mono.cplex.getEnv());
              for (int k = 0; k < data.n; k++) {
                  if (k != j) {
                      for (int p = 0; p < data.p; p++) {
                          if (data._x[p][k][j] == 1) {
                              r_1c += mono.f[MAPf(p,i,j,k,j,data.n)];
                  sprintf(name, "f(%d,%d,%d,%d,%d)",p,i,j,k,j);
                              mono.f[MAPf(p,i,j,k,j,data.n)].setName(name);
              }
              }
          }
          }
              mono.constraints_r1c[cont].setExpr(r_1c);
              cont += 1;
      }
      }
  }

  sprintf(name, "ModelAfterModification.lp");
  mono.cplex.exportModel(name);

}

这是正确的,但是我希望广告牌具有可扩展性,由于矩阵完全是向量,因此不是固有的可扩展性,我该如何实现呢?

尝试使用 XMFLOAT4X4 translationMatrix = XMFLOAT4X4(); translationMatrix._11 = right.x; translationMatrix._21 = up.x; translationMatrix._31 = look.x; translationMatrix._41 = worldposition.x; translationMatrix._12 = right.y; translationMatrix._22 = up.y; translationMatrix._32 = look.y; translationMatrix._42 = worldposition.y; translationMatrix._13 = right.z; translationMatrix._23 = up.z; translationMatrix._33 = look.z; translationMatrix._43 = worldposition.z; translationMatrix._14 = 0; translationMatrix._24 = 0; translationMatrix._34 = 0; translationMatrix._44 = 1; 缩放时,广告牌会在照相机接近时开始移动。

非常感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

如果我对您所做的事情的理解是正确的,则import requests from urllib.parse import urljoin from bs4 import BeautifulSoup URL = "https://stackoverflow.com/questions/tagged/web-scraping" class DataSourcer: def __init__(self,link): self.link = link self.datalist = [] def fetch(self): res = requests.get(self.link) soup = BeautifulSoup(res.text,"lxml") for ilink in soup.select(".summary .question-hyperlink"): self.datalist.append(urljoin(self.link,ilink.get("href"))) def __str__(self): return self.datalist if __name__ == '__main__': crawler = DataSourcer(URL) print(crawler.fetch()) rightup可以简单地表示广告牌局部坐标系的世界空间底矢量。在这种情况下,仅缩放lookright向量就足够了(假设它们对应于向量的 x y 轴)广告牌)满足您内心的需求,而这一切就已经存在了……