private void LineDraw(Vector3 start, Vector3 end) { Vector2 start2 = new Vector2(start.x / start.z, start.y / start.z); Vector2 end2 = new Vector2(end.x / end.z, end.y / end.z); if (lineClip.Line_Clip(ref start2, ref end2)) { start2.x = (int)(((start2.x + 1) / 2) * (resX - 1)); start2.y = (int)(((start2.y + 1) / 2) * (resY - 1)); end2.x = (int)(((end2.x + 1) / 2) * (resX - 1)); end2.y = (int)(((end2.y + 1) / 2) * (resY - 1)); List <Vector2> vectorsRasterised = new List <Vector2>(); vectorsRasterised = rast.Rasterise(start2, end2); foreach (Vector2 v in vectorsRasterised) { //print(start2.x.ToString()); //print(start2.y.ToString()); myTexture.SetPixel((int)v.x, (int)v.y, Color.red); listVectorToErase.Add(v); } } }
// Use this for initialization void Start() { LineClip LC = new LineClip(); Rasterisation rasterisation = new Rasterisation(); Vector2 start = new Vector2(0.5f, 0.3f); Vector2 end = new Vector2(-0.5f, -0.3f); if (LC.Line_Clip(ref start, ref end)) { List <Vector2> vectorsRasterised = new List <Vector2>(); vectorsRasterised = rasterisation.Rasterise(start, end); print("Rasterise"); } }