public static Cone CreateConeShape(Transform o2w, Transform w2o, bool reverseOrientation, ParamSet parameters) { double radius = parameters.FindOneDouble("radius", 1); double height = parameters.FindOneDouble("height", 1); double phimax = parameters.FindOneDouble("phimax", 360); return new Cone(o2w, w2o, reverseOrientation, height, radius, phimax); }
public static Hyperboloid CreateHyperboloidShape(Transform o2w, Transform w2o, bool reverseOrientation, ParamSet parameters) { Point p1 = parameters.FindOnePoint("p1", new Point(0, 0, 0)); Point p2 = parameters.FindOnePoint("p2", new Point(1, 1, 1)); double phimax = parameters.FindOneDouble("phimax", 360); return new Hyperboloid(o2w, w2o, reverseOrientation, p1, p2, phimax); }
public static Paraboloid CreateParaboloidShape(Transform o2w, Transform w2o, bool reverseOrientation, ParamSet parameters) { double radius = parameters.FindOneDouble("radius", 1); double zmin = parameters.FindOneDouble("zmin", 0); double zmax = parameters.FindOneDouble("zmax", 1); double phimax = parameters.FindOneDouble("phimax", 360); return new Paraboloid(o2w, w2o, reverseOrientation, radius, zmin, zmax, phimax); }
public static Disk CreateDiskShape(Transform o2w, Transform w2o, bool reverseOrientation, ParamSet parameters) { double height = parameters.FindOneDouble("height", 0.0d); double radius = parameters.FindOneDouble("radius", 1); double inner_radius = parameters.FindOneDouble("innerradius", 0); double phimax = parameters.FindOneDouble("phimax", 360); return new Disk(o2w, w2o, reverseOrientation, height, radius, inner_radius, phimax); }
public static Sphere CreateSphereShape(Transform o2w, Transform w2o, bool reverseOrientation, ParamSet parameters) { double radius = parameters.FindOneDouble("radius", 1.0d); double zmin = parameters.FindOneDouble("zmin", -radius); double zmax = parameters.FindOneDouble("zmax", radius); double phimax = parameters.FindOneDouble("phimax", 360.0d); return new Sphere(o2w, w2o, reverseOrientation, radius, zmin, zmax, phimax); }
public static TriangleMesh CreateTriangleMeshShape(Transform o2w, Transform w2o, bool reverseOrientation, ParamSet parameters, Dictionary<string, Texture<double>> floatTextures) { throw new NotImplementedException(); //int nvi, npi, nuvi, nsi, nni; //const int *vi = parameters.FindInt("indices", &nvi); //const Point *P = parameters.FindPoint("P", &npi); //const double *uvs = parameters.FindFloat("uv", &nuvi); //if (!uvs) uvs = parameters.FindFloat("st", &nuvi); //bool discardDegnerateUVs = parameters.FindOneBool("discarddegenerateUVs", false); //// XXX should complain if uvs aren't an array of 2... //if (uvs) { // if (nuvi < 2 * npi) { // Error("Not enough of \"uv\"s for triangle mesh. Expencted %d, " // "found %d. Discarding.", 2*npi, nuvi); // uvs = NULL; // } // else if (nuvi > 2 * npi) // Warning("More \"uv\"s provided than will be used for triangle " // "mesh. (%d expcted, %d found)", 2*npi, nuvi); //} //if (!vi || !P) return NULL; //const Vector *S = parameters.FindVector("S", &nsi); //if (S && nsi != npi) { // Error("Number of \"S\"s for triangle mesh must match \"P\"s"); // S = NULL; //} //const Normal *N = parameters.FindNormal("N", &nni); //if (N && nni != npi) { // Error("Number of \"N\"s for triangle mesh must match \"P\"s"); // N = NULL; //} //if (discardDegnerateUVs && uvs && N) { // // if there are normals, check for bad uv's that // // give degenerate mappings; discard them if so // const int *vp = vi; // for (int i = 0; i < nvi; i += 3, vp += 3) { // double area = .5f * Cross(P[vp[0]]-P[vp[1]], P[vp[2]]-P[vp[1]]).Length(); // if (area < 1e-7) continue; // ignore degenerate tris. // if ((uvs[2*vp[0]] == uvs[2*vp[1]] && // uvs[2*vp[0]+1] == uvs[2*vp[1]+1]) || // (uvs[2*vp[1]] == uvs[2*vp[2]] && // uvs[2*vp[1]+1] == uvs[2*vp[2]+1]) || // (uvs[2*vp[2]] == uvs[2*vp[0]] && // uvs[2*vp[2]+1] == uvs[2*vp[0]+1])) { // Warning("Degenerate uv coordinates in triangle mesh. Discarding all uvs."); // uvs = NULL; // break; // } // } //} //for (int i = 0; i < nvi; ++i) // if (vi[i] >= npi) { // Error("trianglemesh has out of-bounds vertex index %d (%d \"P\" values were given", // vi[i], npi); // return NULL; // } //Reference<Texture<double> > alphaTex = NULL; //string alphaTexName = params.FindTexture("alpha"); //if (alphaTexName != "") { // if (floatTextures->find(alphaTexName) != floatTextures->end()) // alphaTex = (*floatTextures)[alphaTexName]; // else // Error("Couldn't find double texture \"%s\" for \"alpha\" parameter", // alphaTexName.c_str()); //} //else if (params.FindOneFloat("alpha", 1.f) == 0.f) // alphaTex = new ConstantTexture<double>(0.f); //return new TriangleMesh(o2w, w2o, reverseOrientation, nvi/3, npi, vi, P, // N, S, uvs, alphaTex); }