0
Hi, My problem is in the array following this code:
mesh meshCube;
string[] file = File.ReadAllLines("object.mind");
foreach (string filetext in file)
{
if (filetext.Contains("v"))
{
string ext = filetext.Substring(filetext.IndexOf(" ") + 1);
string[] pos = ext.Split(' ');
// erro nessa linha ↓
meshCube.tris.Add( new triangle (
new vec3d(float.Parse(pos[0]), float.Parse(pos[1]), float.Parse(pos[2])),
new vec3d(float.Parse(pos[3]), float.Parse(pos[4]), float.Parse(pos[5])),
new vec3d(float.Parse(pos[6]), float.Parse(pos[7]), float.Parse(pos[8])))
);
}
}
public class vec3d
{
public vec3d(float x, float y, float z)
{
this.x = x;
this.y = y;
this.z = z;
}
public float x { get; set; }
public float y { get; set; }
public float z { get; set; }
}
public class triangle
{
public triangle(vec3d one, vec3d two, vec3d three)
{
p = new[] { one, two, three };
}
public vec3d[] p = new vec3d[3];
}
public class mesh
{
public List<triangle> tris = new List<triangle>();
}
Hello @autergame Welcome to Stackoverflow, what is your problem? what have you tried to solve? what is the result of these attempts? please add these answers to your question to make it clearer, I suggest you read [Ask] and [mcve]
– Lucas Duete
Hello, where exactly does the mistake happen and what do you really need? explains a little about your business rule...
– Adjair Costa