// Update is called once per frame void Update() { if (cam.pixelRect.Contains(Input.mousePosition)) { if (Input.GetMouseButtonDown(0)) { Vector3 p = mouseToLocal(); curve.Add(p, 1.0f); } if (Input.GetMouseButtonDown(1)) { Vector3 p = mouseToLocal(); selected = Closest(p, 0.1f); if (selected != -1) { move = true; } } if (Input.GetMouseButton(1)) { if (move && selected != -1) { Vector3 p = mouseToLocal(); curve.position [selected] = p; } } if (Input.GetKeyDown(KeyCode.X)) { curve.position.Clear(); } if (Input.GetAxis("Mouse ScrollWheel") < 0) { Vector3 p = mouseToLocal(); int change = Closest(p, 0.1f); if (change != -1) { curve.weight [change] *= 0.9f; } } if (Input.GetAxis("Mouse ScrollWheel") > 0) { Vector3 p = mouseToLocal(); int change = Closest(p, 0.1f); if (change != -1) { curve.weight [change] *= 1.1f; } } } l.Clear(); l.currentColor = Color.blue; l.AddLine(curve.position); l.currentColor = Color.red; l.AddLine(curve.DrawNurbs()); }
void BasisDrawCompute() { int nbBasis = b.knot.Count - b.degree - 1; for (int k = 0; k < nbBasis; ++k) { l.currentColor = colorChoice [k % 3]; l.AddLine(b.DrawBasis(k)); } }