js如何读取向量vector的各个值

JavaScript011

js如何读取向量vector的各个值,第1张

#include<iostream>

#include<vector>

#include<string>

using namespace std

int main()

{

cout <<"Vector for string" <<endl

const string str[] = { "The", "vector", "for", "strings." }

vector <string >svec(str, str + 4)

vector <string >::iterator its// iterator for the string vector

for (its = svec.begin()its != svec.end()its++)

cout <<*its <<" "// dereference the iterator to get the string

cout <<"\n"

return 0

}

Vector3是用于3D编程的一种类

Vector3 = function(x,y,z) {......}

Vector3.prototype = {......}

三维向量可用Vector3类实现,Vector3亦用来表示空间中的点。

可在网上查一些关于用javascript实现3D的计算机图形学方面的文章