public Knot( ClosedCurve curve, OculusTouch oculusTouch, float distanceThreshold = -1, List <Curve>?collisionCurves = null, LogicalButton?buttonA = null, LogicalButton?buttonB = null, LogicalButton?buttonC = null, LogicalButton?buttonD = null, Material?curveMaterial = null, Material?pullableCurveMaterial = null, Material?pointMaterial = null ) { buttonA = buttonA ?? LogicalOVRInput.RawButton.A; buttonB = buttonB ?? LogicalOVRInput.RawButton.B; buttonC = buttonC ?? LogicalOVRInput.RawButton.RIndexTrigger; buttonD = buttonD ?? LogicalOVRInput.RawButton.RHandTrigger; int count = curve.GetPoints().Count; (int first, int second)chosenPoints = (count / 3, 2 * count / 3); KnotData data = new KnotData(curve, chosenPoints, oculusTouch, distanceThreshold, collisionCurves, buttonA, buttonB, buttonC, buttonD, curveMaterial, pullableCurveMaterial, pointMaterial); this.state = new KnotStateBase(data); HandCurve.SetUp(oculusTouch, drawButton: buttonC, moveButton: buttonD); }
public Knot( List <Vector3> points, OculusTouch oculusTouch, int meridian = 20, float radius = 0.1f, float distanceThreshold = -1, List <Curve> collisionCurves = null, LogicalButton buttonA = null, LogicalButton buttonB = null, LogicalButton buttonC = null, LogicalButton buttonD = null, Material curveMaterial = null, Material pullableCurveMaterial = null, Material pointMaterial = null ) { buttonA = buttonA ?? LogicalOVRInput.RawButton.A; buttonB = buttonB ?? LogicalOVRInput.RawButton.B; buttonC = buttonC ?? LogicalOVRInput.RawButton.RIndexTrigger; buttonD = buttonD ?? LogicalOVRInput.RawButton.RHandTrigger; int count = points.Count; (int first, int second)chosenPoints = (count / 3, 2 * count / 3); KnotData data = new KnotData(points, chosenPoints, oculusTouch, radius, meridian, distanceThreshold, collisionCurves, buttonA, buttonB, buttonC, buttonD, curveMaterial, pullableCurveMaterial, pointMaterial); this.state = new KnotStateBase(data); Curve.SetUp(oculusTouch, drawButton: buttonC, moveButton: buttonD); }
public OpenFile(OculusTouch oculusTouch, ContextMenu.ContextMenu contextMenu, DataHandler dataHandler, List <Curve> curves) : base(oculusTouch, contextMenu, dataHandler, curves) { base.NumberOfUnselectableItems = 4; }
public State(OculusTouch oculusTouch, ContextMenu.ContextMenu contextMenu, DataHandler dataHandler, List <Curve> curves) { this.oculusTouch = oculusTouch; this.contextMenu = contextMenu; this.dataHandler = dataHandler; this.SetupMenu(); this.curves = curves; this.epsilon = this.segment * 0.2f; this.newState = null; }
public Optimize(OculusTouch oculusTouch, List <HandCurve> deformableCurves, List <HandCurve> collisionCurves, float segment, float epsilon, string flowClass, LogicalButton button1, LogicalButton button2) { this.deformableCurves = deformableCurves; List <Vector3[]> pointsList = new List <Vector3[]>(); this.collisionCurves = collisionCurves; if (segment <= 0) { throw new System.Exception("segment must be positive"); } this.segment = segment; this.oculusTouch = oculusTouch; for (int i = 0; i < this.deformableCurves.Count; i++) { if (!(this.deformableCurves[i].curve is ClosedCurve)) { throw new System.Exception("curves must be closed"); } this.deformableCurves[i].curve = this.deformableCurves[i].curve.Equalize(this.deformableCurves[i].segment); this.deformableCurves[i].MeshUpdate(); pointsList.Add(this.deformableCurves[i].curve.GetPoints().ToArray()); this.minSeg = Mathf.Min(this.minSeg, this.deformableCurves[i].segment); } if (flowClass == "Moebius") { curveFlow = new Moebius(pointsList, this.segment, 1e-04f); } else if (flowClass == "MeanCurvature") { curveFlow = new MeanCurvature(pointsList, this.segment, 0.05f); } elasticity = new Elasticity(pointsList, this.segment, 1e-01f); this.button1 = button1; this.button2 = button2; this.epsilon = epsilon; }
public static int FindClosestPoint(OculusTouch oculusTouch, List <Vector3> points) { // KnotStateChoose2 からも呼び出せるように static メソッドにした Vector3 controllerPosition = oculusTouch.GetPositionR(); int closestIndex = 0; float closestDistance = Vector3.Distance(points[closestIndex], controllerPosition); for (int i = 1; i < points.Count; i++) { float distance = Vector3.Distance(points[i], controllerPosition); if (distance < closestDistance) { closestIndex = i; closestDistance = distance; } } return(closestIndex); }
public ContextMenu( OculusTouch controller, LogicalButton upButton, LogicalButton downButton, LogicalButton confirmButton, LogicalButton toggleMenuButton, uint?lockLevel = 10 ) { this.controller = controller; this.upButton = upButton; this.downButton = downButton; this.confirmButton = confirmButton; this.toggleMenuButton = toggleMenuButton; this.lockLevel = lockLevel; FindCanvasObject(); LoadPrefabs(); CreatePanel(); }
public Controller() { this.oculusTouch = new OculusTouch ( buttonMap: LiteralKeysPlus, rightStickKey: PredefinedMaps.WASD, rightHandKey: PredefinedMaps.OKLSemiIComma, handScale: 0.03f, handSpeed: 0.01f ); this.changeState = LogicalOVRInput.RawButton.LIndexTrigger; this.draw = LogicalOVRInput.RawButton.RIndexTrigger; this.move = LogicalOVRInput.RawButton.RHandTrigger; this.select = LogicalOVRInput.RawButton.A; this.cut = LogicalOVRInput.RawButton.B; this.combine = LogicalOVRInput.RawButton.X; this.remove = LogicalOVRInput.RawButton.Y; this.undo = LogicalOVRInput.RawButton.LHandTrigger; this.pull = LogicalOVRInput.RawButton.X; this.energy = LogicalOVRInput.RawButton.Y; }
public Optimize(OculusTouch oculusTouch, List <Curve> newCurves, List <Curve> collisionCurves, float epsilon, LogicalButton button1, LogicalButton button2) { this.newCurves = newCurves; this.collisionCurves = collisionCurves; this.oculusTouch = oculusTouch; for (int i = 0; i < this.newCurves.Count; i++) { this.newCurves[i].points = AdjustParameter.Equalize(this.newCurves[i].points, this.newCurves[i].segment, true); this.newCurves[i].MomentumInitialize(); } // this.intersectionManager = new IntersectionManager(this.newCurves, this.collisionCurves, epsilon); this.button1 = button1; this.button2 = button2; this.epsilon = epsilon; }
void Start() { this.oculusTouch = new OculusTouch ( buttonMap: LiteralKeysPlus, leftStickKey: PredefinedMaps.Arrows, rightHandKey: PredefinedMaps.OKLSemiIComma, handScale: 0.03f, handSpeed: 0.01f ); this.comfirmBotton = LogicalOVRInput.RawButton.X; this.contextMenu = new ContextMenu.ContextMenu( this.oculusTouch, upButton: LogicalOVRInput.RawButton.LStickUp, downButton: LogicalOVRInput.RawButton.LStickDown, confirmButton: comfirmBotton, toggleMenuButton: LogicalOVRInput.RawButton.LIndexTrigger, lockLevel: null ); this.contextMenu.AddItem(new MenuItem("左人差し指 : メニューウィンドウの開閉", () => {})); this.contextMenu.AddItem(new MenuItem("左スティック : カーソルの移動", () => {})); this.contextMenu.AddItem(new MenuItem("Xボタン : メニューでの決定ボタン", () => {})); this.contextMenu.AddItem(new MenuItem("", () => {})); this.contextMenu.Open(); this.dataHandler = new DataHandler( inputDirOnPC: "CurveData", outputDirOnPC: "CurveData", cacheDirOnPC: "CurveData", inputDirOnHMD: "/mnt/sdcard/CurveData", outputDirOnHMD: "/mnt/sdcard/CurveData", cacheDirOnHMD: "/mnt/sdcard/CurveData" ); this.state = new BasicDeformation(this.oculusTouch, this.contextMenu, this.dataHandler, new List <Curve>(), comfirm: comfirmBotton); }
public BasicDeformation(OculusTouch oculusTouch, ContextMenu.ContextMenu contextMenu, DataHandler dataHandler, List <Curve> curves, LogicalButton changeState = null, LogicalButton draw = null, LogicalButton move = null, LogicalButton select = null, LogicalButton cut = null, LogicalButton comfirm = null) : base(oculusTouch, contextMenu, dataHandler, curves) { base.NumberOfUnselectableItems = 9; this.preCurves = base.curves; this.drawingCurve = new Curve(new List <Vector3>(), false); this.movingCurves = new List <int>(); if (draw != null) { this.draw = draw; } else { this.draw = LogicalOVRInput.RawButton.RIndexTrigger; } if (move != null) { this.move = move; } else { this.move = LogicalOVRInput.RawButton.RHandTrigger; } if (select != null) { this.select = select; } else { this.select = LogicalOVRInput.RawButton.A; } if (cut != null) { this.cut = cut; } else { this.cut = LogicalOVRInput.RawButton.B; } if (comfirm != null) { this.comfirm = comfirm; } else { this.comfirm = LogicalOVRInput.RawButton.X; } Curve.SetUp(base.oculusTouch, this.draw, this.move); }
public static void SetUp(OculusTouch oculusTouch, LogicalButton drawButton, LogicalButton moveButton) { HandCurve.oculusTouch = oculusTouch; HandCurve.drawButton = drawButton; HandCurve.moveButton = moveButton; }