// Update is called once per frame void Update() { // 坐標軸的模式 axis_mode = (AxisMode)fitAxisMode(); // 往哪個軸移動 axis_direction = (Direction)direction(); valid_x2 = Input.mousePosition.x / Screen.width; if (valid_x2 < WIDTH_LEFT) { x2 = MIN_X; } else if (valid_x2 > WIDTH_RIGHT) { x2 = MAX_X; } else { x2 = (valid_x2 - WIDTH_LEFT) * width_scale - SCALE / 2; } //--------------------------------------------------------- valid_y2 = Input.mousePosition.y / Screen.height; if (valid_y2 < HEIGHT_DOWN) { y2 = MIN_Y; } else if (valid_y2 > HEIGHT_UP) { y2 = MAX_Y; } else { y2 = (valid_y2 - HEIGHT_DOWN) * height_scale - SCALE / 2; } mouse_vector2 = mouseVector2(); //print(direction()); x_axis = axisVector2(transform.right); y_axis = axisVector2(transform.up); z_axis = axisVector2(transform.forward); pre_x2 = x2; pre_y2 = y2; if (Input.GetKeyDown(KeyCode.M)) { print(fitAxisMode()); } if (Input.GetKeyDown(KeyCode.V)) { print(string.Format("{0}", axis_direction)); } if (Input.GetKeyDown(KeyCode.C)) { Vector3 vector3 = new Vector3(projection_x, projection_y, projection_z); print(string.Format("projection: {0}", vector3)); } }
// Update is called once per frame void Update() { // 坐標軸的模式 axis_mode = (AxisMode)fitAxisMode(); valid_x2 = Input.mousePosition.x / Screen.width; valid_y2 = Input.mousePosition.y / Screen.height; // 判斷是否超出"可操作區域" if (valid_x2 < GameInfo.LEFT || GameInfo.RIGHT < valid_x2 || valid_y2 < GameInfo.DOWN || GameInfo.UP < valid_y2) { // 超出"可操作區域":維持上一時刻的位置 x2 = pre_x2; y2 = pre_y2; GameInfo.InVaildArea = false; } else { // "可操作區域"內:將 x2, y2 轉換為 -5 ~ 5 的數值 x2 = (valid_x2 - GameInfo.LEFT) * width_scale - GameInfo.SCALE / 2; y2 = (valid_y2 - GameInfo.DOWN) * height_scale - GameInfo.SCALE / 2; GameInfo.InVaildArea = true; } // 計算滑鼠位置 mouse_pos = new Vector2(x2, y2); // 計算滑鼠移動的向量(新 減 舊) mouse_vector2 = mouseVector2(); // 當滑鼠有移動,才更新 軸移動的方向 if (mouse_vector2 != Vector2.zero) { // 往哪個軸移動 axis_direction = (Direction)direction(); } // 三軸的三維向量 x_axis3 = transform.right; y_axis3 = transform.up; z_axis3 = transform.forward; x_axis3_length = x_axis3.magnitude; y_axis3_length = y_axis3.magnitude; z_axis3_length = x_axis3.magnitude; // 三軸投影到平面的二維向量 x_axis = axisVector2(transform.right); y_axis = axisVector2(transform.up); z_axis = axisVector2(transform.forward); x_axis2_length = x_axis.magnitude; y_axis2_length = y_axis.magnitude; z_axis2_length = z_axis.magnitude; // 更新上一時刻的位置 pre_x2 = x2; pre_y2 = y2; }
public void CopyFrom(BrushSettings other) { brushRadius = other.brushRadius; brushSpacing = other.brushSpacing; brushOverlapCheckMode = other.brushOverlapCheckMode; brushOverlapDistance = other.brushOverlapDistance; brushOverlapCheckObjects = other.brushOverlapCheckObjects; brushOverlapCheckLayers = other.brushOverlapCheckLayers; surfaceOffset = other.surfaceOffset; orientationTransformMode = other.orientationTransformMode; orientationMode = other.orientationMode; alongBrushStroke = other.alongBrushStroke; rotation = other.rotation; randomizeOrientationX = other.randomizeOrientationX; randomizeOrientationY = other.randomizeOrientationY; randomizeOrientationZ = other.randomizeOrientationZ; scaleTransformMode = other.scaleTransformMode; scaleMode = other.scaleMode; scaleUniformMin = other.scaleUniformMin; scaleUniformMax = other.scaleUniformMax; scalePerAxisMin = other.scalePerAxisMin; scalePerAxisMax = other.scalePerAxisMax; pinFixedRotation = other.pinFixedRotation; pinFixedRotationValue = other.pinFixedRotationValue; pinFixedScale = other.pinFixedScale; pinFixedScaleValue = other.pinFixedScaleValue; placeScale = other.placeScale; placeEulerAngles = other.placeEulerAngles; multibrushEnabled = other.multibrushEnabled; multibrushPaintSelectedSlot = other.multibrushPaintSelectedSlot; multibrushMode = other.multibrushMode; multibrushPattern = other.multibrushPattern; multibrushPatternContinue = other.multibrushPatternContinue; for (int i = 0; i < kNumMultibrushSlots; i++) { multibrushSlots[i] = other.multibrushSlots[i]; } slopeEnabled = other.slopeEnabled; slopeAngleMin = other.slopeAngleMin; slopeAngleMax = other.slopeAngleMax; slopeVector = other.slopeVector; slopeVectorCustom = other.slopeVectorCustom; slopeVectorFlip = other.slopeVectorFlip; gridEnabled = other.gridEnabled; gridOrigin = other.gridOrigin; gridStep = other.gridStep; gridPlane = other.gridPlane; gridNormal = other.gridNormal; gridAngle = other.gridAngle; }
internal TargetFontModification(string name, AxisMode axis, float sizePx, float scale) { this.Name = name; this.Axis = axis; this.TargetSizePx = sizePx; this.Scale = scale; this.SourceAxis = Service <GameFontManager> .Get().NewFontRef(new(GameFontFamily.Axis, sizePx * scale * 3 / 4)); }
private string EQ_SendGCode(AxisId axisId, HemisphereOption hemisphere, AxisMode mode, AxisDirection direction, AxisSpeed speed) { System.Diagnostics.Debug.WriteLine(string.Format("EQ_SendGCode({0}, {1}, {2}, {3}, {4})", axisId, hemisphere, mode, direction, speed)); byte ch; ch = 0; // Set Direction bit (Bit 0) if (direction == AxisDirection.Reverse) { ch |= 0x01; } // Set Hemisphere bit (Bit 1) if (hemisphere == HemisphereOption.Southern) { ch |= 0x02; } // 0 = high speed GOTO mode // 1 = low speed SLEW mode // 2 = low speed GOTO mode // 3 = high speed SLEW mode // Set Mode and speed bits if (mode == AxisMode.Goto) { //goto if (speed == AxisSpeed.LowSpeed) { // Low speed goto = 2 ch |= 0x20; } else { //high speed goto = 0 } } else { // slew if (speed == AxisSpeed.HighSpeed) { // High speed slew= 3 ch |= 0x30; } else { // low speed slew= 1 ch |= 0x10; } } // Send 'G' Command, with parameter return(GetEQSendCommandCommand(axisId, 'G', ch, 2)); }
protected string MCSetMotionMode(AxisId axis, HemisphereOption hemisphere, AxisMode mode, AxisDirection direction, AxisSpeed speed) { byte ch; ch = 0; // Set Direction bit (Bit 0) if (direction == AxisDirection.Reverse) { ch |= 0x01; } // Set Hemisphere bit (Bit 1) if (hemisphere == HemisphereOption.Southern) { ch |= 0x02; } // 0 = high speed GOTO mode // 1 = low speed SLEW mode // 2 = low speed GOTO mode // 3 = high speed SLEW mode // Set Mode and speed bits if (mode == AxisMode.Goto) { //goto if (speed == AxisSpeed.LowSpeed) { // Low speed goto = 2 ch |= 0x20; } else { //high speed goto = 0 } } else { // slew if (speed == AxisSpeed.HighSpeed) { // High speed slew= 3 ch |= 0x30; } else { // low speed slew= 1 ch |= 0x10; } } string szCmd = LongTo2BitHEX(ch); return(GetTalkWithAxisCommand(axis, 'G', szCmd)); }
public void ResetScale() { scaleTransformMode = TransformMode.Relative; scaleMode = AxisMode.Uniform; scaleUniformMin = 1.0f; scaleUniformMax = 1.0f; scalePerAxisMin = new Vector3(1, 1, 1); scalePerAxisMax = new Vector3(1, 1, 1); }
private void Awake() { // キャッシュ類 mTrans = transform; mTestUIManager = GameObject.Find("Canvas_TestUI").GetComponent <TestUIManager>(); // パラメータの初期化 mEditMode = EditMode.EditPosition_Move; mAxisMode = AxisMode.X; }
private void Awake() { // キャッシュ類 this.trans = transform; this.testUiManager = GameObject.Find("Canvas_TestUI").GetComponent <TestUIManager>(); // パラメータの初期化 this.editMode = EditMode.EditPositionMove; this.axisMode = AxisMode.X; }
/// <summary> /// Axis构造方法(有参数的) /// </summary> /// <param name="labelsNumber">标签数量[3-126]</param> /// <param name="maxValue">轴的最大值</param> /// <param name="minValue">轴的最小值</param> /// <param name="units">轴的单位</param> /// <param name="startPoint">轴的起点(左上角)</param> /// <param name="endPoint">轴的终点(右下角)</param> /// <param name="axisMode">轴的显示方式(垂直、水平两种,默认是垂直)</param> /// <param name="labelsFontColor">标签的字体颜色</param> /// <param name="grid">轴的显示平台</param> public Axis(byte labelsNumber, double maxValue, double minValue, string units, Point startPoint, Point endPoint, AxisMode axisMode, SolidColorBrush labelsFontColor, Grid grid) { this._labelsNumber = labelsNumber; this._maxValue = maxValue; this._minValue = minValue; this._unit = units; this._startPoint = startPoint; this._endPoint = endPoint; this._axisMode = axisMode; this._labelsFontColor = labelsFontColor; this._grid = grid; }
private void UpdateResizingPath(AxisMode path) { AnnotationResizer annotationResizer = Chart.AnnotationManager.AnnotationResizer; if (annotationResizer != null) { if (annotationResizer.ResizingMode != path) { annotationResizer.ResizingMode = path; annotationResizer.ResizerControl.ChangeView(); } } }
private void ChangeAxisMode() { if (Input.GetKey(KeyCode.X)) { mAxisMode = AxisMode.X; } if (Input.GetKey(KeyCode.Y)) { mAxisMode = AxisMode.Y; } if (Input.GetKey(KeyCode.Z)) { mAxisMode = AxisMode.Z; } SendMode(); }
public void Render(VisualPayload payload, IMetaSelectable selectable) { RenderAxisLabel(payload); // Optional 'Axis title' // Labels along an axis: var mode = AxisMode.GetLastKeyValue(payload.Data); if (mode == AxialLabelAxisMode.Discrete) { // create equality criteria var normalSelector = PayloadSelectorFactory.InstantiateCriterionEqualsSelect(selectable); normalSelector.SelectionMode.OperationToPerform = SelectionOperation.SelectOnly; normalSelector.CriterionField = (mut) => AxisIndexVariable.GetValue(mut); normalSelector.ArrityLevels = AxisIndexVariable.NumberOfIntermediates; var toggleSelector = PayloadSelectorFactory.InstantiateCriterionEqualsSelect(selectable); toggleSelector.SelectionMode.OperationToPerform = SelectionOperation.ToggleFullySelected; toggleSelector.RequiredModifiers = new InputModifiers() { Control = true }; toggleSelector.CriterionField = (mut) => AxisIndexVariable.GetValue(mut); toggleSelector.ArrityLevels = AxisIndexVariable.NumberOfIntermediates; normalSelector.FieldLastKey = AxisIndexVariable.AbsoluteKey; toggleSelector.FieldLastKey = AxisIndexVariable.AbsoluteKey; var discreteCriterionSelectors = new List <ICriterionMetaSelector>() { normalSelector, toggleSelector }; RenderItemLabelsDiscrete(payload, discreteCriterionSelectors); } else if (mode == AxialLabelAxisMode.Continuous) { // create range criteria var normalRangeSelector = PayloadSelectorFactory.InstantiateCriterionRangeSelect(selectable); normalRangeSelector.SelectionMode.OperationToPerform = SelectionOperation.SelectOnly; normalRangeSelector.CriterionField = (mut) => ComparisonValue.GetValue(mut); normalRangeSelector.ArrityLevels = ComparisonValue.NumberOfIntermediates; var toggleRangeSelector = PayloadSelectorFactory.InstantiateCriterionRangeSelect(selectable); toggleRangeSelector.SelectionMode.OperationToPerform = SelectionOperation.ToggleFullySelected; toggleRangeSelector.RequiredModifiers = new InputModifiers() { Control = true }; toggleRangeSelector.CriterionField = (mut) => ComparisonValue.GetValue(mut); toggleRangeSelector.ArrityLevels = ComparisonValue.NumberOfIntermediates; normalRangeSelector.FieldLastKey = ComparisonValue.AbsoluteKey; toggleRangeSelector.FieldLastKey = ComparisonValue.AbsoluteKey; var continuousCriterionSelectors = new List <ICriterionMetaSelector>() { normalRangeSelector, toggleRangeSelector }; RenderItemLabelsContinuous(payload, continuousCriterionSelectors); } }
public void CopyFrom(BrushSettings other) { brushRadius = other.brushRadius; brushSpacing = other.brushSpacing; brushOverallScale = other.brushOverallScale; brushOverlapCheck = other.brushOverlapCheck; brushOverlapCheckMode = other.brushOverlapCheckMode; brushOverlapDistance = other.brushOverlapDistance; brushOverlapCheckObjects = other.brushOverlapCheckObjects; brushOverlapCheckLayers = other.brushOverlapCheckLayers; maxAlpha = other.maxAlpha; minAlpha = other.minAlpha; ppOrientationMode = other.ppOrientationMode; ppFlipOrientation = other.ppFlipOrientation; ppFixedRotation = other.ppFixedRotation; ppFixedRotationValue = other.ppFixedRotationValue; ppFixedRotationTransformMode = other.ppFixedRotationTransformMode; ppFixedScale = other.ppFixedScale; ppFixedScaleValue = other.ppFixedScaleValue; ppFixedScaleTransformMode = other.ppFixedScaleTransformMode; positionOffset = other.positionOffset; orientationTransformMode = other.orientationTransformMode; orientationMode = other.orientationMode; flipOrientation = other.flipOrientation; rotation = other.rotation; randomizeOrientationX = other.randomizeOrientationX; randomizeOrientationY = other.randomizeOrientationY; randomizeOrientationZ = other.randomizeOrientationZ; scaleTransformMode = other.scaleTransformMode; scaleMode = other.scaleMode; scaleUniformMin = other.scaleUniformMin; scaleUniformMax = other.scaleUniformMax; scalePerAxisMin = other.scalePerAxisMin; scalePerAxisMax = other.scalePerAxisMax; scaleAux = other.scaleAux; multibrushEnabled = other.multibrushEnabled; multibrushPaintSelectedSlot = other.multibrushPaintSelectedSlot; multibrushMode = other.multibrushMode; multibrushPattern = other.multibrushPattern; multibrushPatternContinue = other.multibrushPatternContinue; for (int i = 0; i < kNumMultibrushSlots; i++) { multibrushSlots[i] = other.multibrushSlots[i]; } advancedSettingsEnabled = other.advancedSettingsEnabled; slopeEnabled = other.slopeEnabled; slopeAngleMin = other.slopeAngleMin; slopeAngleMax = other.slopeAngleMax; slopeVector = other.slopeVector; slopeVectorCustom = other.slopeVectorCustom; slopeVectorFlip = other.slopeVectorFlip; gridEnabled = other.gridEnabled; gridOrigin = other.gridOrigin; gridStep = other.gridStep; gridPlane = other.gridPlane; gridNormal = other.gridNormal; gridAngle = other.gridAngle; }
protected void SetAxisMarkerValue(object X1, object X2, object Y1, object Y2, AxisMode axisMode) { AxisMarkerObject.X1 = X1; AxisMarkerObject.X2 = X2; AxisMarkerObject.Y1 = Y1; AxisMarkerObject.Y2 = Y2; AxisMarkerObject.XAxisName = this.XAxisName; AxisMarkerObject.YAxisName = this.YAxisName; AxisMarkerObject.YAxis = this.YAxis; AxisMarkerObject.XAxis = this.XAxis; AxisMarkerObject.DraggingMode = axisMode; }