public ObjectFaceF InitMember(IList <Vector3> vertices, IList <int> triangles) { if (weak_faceFs != null) { weak_faceFs.Dispose(); } weak_faceFs = CollectionPool <FaceF> .ListCell.Create(); for (int i = 0; i + 2 < triangles.Count; i += 3) { var faceF = ObjectPool <FaceF> .Create(initFacef, construct); weak_faceFs.Add(faceF); void initFacef(FaceF cell) => cell.InitMember( vertices[triangles[i]], vertices[triangles[i + 1]], vertices[triangles[i + 2]]); FaceF construct() => new FaceF( vertices[triangles[i]], vertices[triangles[i + 1]], vertices[triangles[i + 2]]); } disposedValue = false; return(this); }
public FaceF InitMember(Vector3 p1, Vector3 p2, Vector3 p3) { if (weak_vertices != null) { weak_vertices.Dispose(); } weak_vertices = CollectionPool <Vector3> .ListCell.Create(p1, p2, p3); PlaneNormal = Vector3.Cross(p2 - p1, p3 - p1).normalized; DisOrigin2plane = Vector3.Dot(PlaneNormal, p1); disposedValue = false; return(this); }