can any one help me
i have created mesh and add vertices to it then add faces by this vertices
how can i add texture to this face
public static Rhino.Commands.Result AddRoofMesh(Rhino.RhinoDoc doc, Point3d[] points)
{
Point3d p1 = points[0];
Point3d p2 = points[1];
Point3d p3 = points[2];
Point3d p4 = points[3];
Rhino.Geometry.Mesh mesh2 = new Rhino.Geometry.Mesh();
Point3d p5 = new Point3d(p1.X, p1.Y, p1.Z);
Point3d p6 = new Point3d(p2.X, p2.Y, p2.Z);
Point3d p7 = new Point3d(p3.X, p3.Y, p3.Z);
Point3d p8 = new Point3d(p4.X, p4.Y, p4.Z);
float[][] faces = new float[][] { new float[] { (float)p1.X, (float)p1.Y, (float)p1.Z }, new float[] { (float)p2.X, (float)p2.Y, (float)p2.Z }, new float[] { (float)p3.X, (float)p3.Y, (float)p3.Z } };
float[] norm = new float[3];
calcNormal(faces, out norm);
Point3d pntNormal = ReduceToUnit(norm);
double thick = .2;
p5.X += (pntNormal.X * thick);
p5.Y += (pntNormal.Y * thick);
p5.Z += (pntNormal.Z * thick);
p6.X += (pntNormal.X * thick);
p6.Y += (pntNormal.Y * thick);
p6.Z += (pntNormal.Z * thick);
p7.Y += (pntNormal.Y * thick);
p7.X += (pntNormal.X * thick);
p7.Z += (pntNormal.Z * thick);
p8.X += (pntNormal.X * thick);
p8.Y += (pntNormal.Y * thick);
p8.Z += (pntNormal.Z * thick);
mesh2.Vertices.Add(p5); //0 //4
mesh2.Vertices.Add(p6); //1 //5
mesh2.Vertices.Add(p7); //2 //6
mesh2.Vertices.Add(p8); //3 //7
// add mesh 1
mesh2.Vertices.Add(p1); //4 //8
mesh2.Vertices.Add(p2); //5 //9
mesh2.Vertices.Add(p3); //6 //10
mesh2.Vertices.Add(p4); //7 //11
mesh2.Faces.AddFace(0, 1, 2, 3);
mesh2.Faces.AddFace(4, 5, 6, 7);
mesh2.Faces.AddFace(8, 9, 5, 4);
mesh2.Faces.AddFace(11, 8, 4, 7);
mesh2.Faces.AddFace(11, 10, 6, 7);
mesh2.Faces.AddFace(9, 10, 6, 5);
mesh2.Compact();
if ( (doc.Objects.AddMesh(mesh2) != Guid.Empty))
{
doc.Views.Redraw();
return Rhino.Commands.Result.Success;
}
return Rhino.Commands.Result.Failure;
}
this is my code