Skip to content

Commit

Permalink
upload demo files
Browse files Browse the repository at this point in the history
  • Loading branch information
Mogoson committed Sep 17, 2021
1 parent e2a47d3 commit d0d5a38
Show file tree
Hide file tree
Showing 18 changed files with 70 additions and 12 deletions.
Binary file added Attachment/images/MonoBezierCurveRenderer.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Attachment/images/MonoEllipseCurveRenderer.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Attachment/images/MonoHelixCurveRenderer.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Attachment/images/MonoHermiteCurveRenderer.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Attachment/images/MonoSinCurveRenderer.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@
## Implemented

```C#
public abstract class MonoCurve : MonoBehaviour, IMonoCurve
public class MonoSinCurve : MonoCurve{}
public class MonoEllipseCurve : MonoCurve{}
public class MonoHelixCurve : MonoCurve{}
public class MonoBezierCurve : MonoCurve{}
public class MonoHermiteCurve : MonoCurve{}

public abstract class MonoCurveRenderer : MonoBehaviour, IMonoCurveRenderer{}
public class MonoCurveLineRenderer : MonoCurveRenderer{}
```

## Technology
Expand All @@ -41,6 +45,16 @@ return transform.TransformPoint(worldVector);
transform.InverseTransformPoint(localVector);
```

### Differentiation

```C#
//AwayFromZero means that 12.5 -> 13
var units = (int)Math.Round(curve.Length * detail.unit, MidpointRounding.AwayFromZero);
var count = Mathf.Clamp(units, detail.min, detail.max);
differ = curve.Length / count;
return count;
```

### Calculus

```C#
Expand Down Expand Up @@ -97,7 +111,7 @@ Press and hold the ALT+SHIFT into InOutTangent Edit mode, drag the handle to adj
If the start and end points are close, they will stick together.
```


- Attach mono curve renderer component to the mono curve game object to renderer curve in scene.

- Evaluate point on the mono curve.

Expand Down Expand Up @@ -133,6 +147,14 @@ while (t < 1.0f)

## Preview

- MonoHermiteCurveRenderer

![](.\Attachment\images\MonoHermiteCurveRenderer.PNG)

- MonoBezierCurveRenderer

![](.\Attachment\images\MonoBezierCurveRenderer.PNG)

- MonoHermiteCurve

![](./Attachment/images/MonoHermiteCurve.png)
Expand Down
Binary file modified UnityProject/Assets/MGS.Packages/Curve/Demo/Material/Blue.mat
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
30 changes: 22 additions & 8 deletions UnityProject/Assets/MGS.Packages/Curve/Plugins/MGS.MonoCurve.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@
## Implemented

```C#
public abstract class MonoCurve : MonoBehaviour, IMonoCurve
public class MonoSinCurve : MonoCurve{}
public class MonoEllipseCurve : MonoCurve{}
public class MonoHelixCurve : MonoCurve{}
public class MonoBezierCurve : MonoCurve{}
public class MonoHermiteCurve : MonoCurve{}

public abstract class MonoCurveRenderer : MonoBehaviour, IMonoCurveRenderer{}
public class MonoCurveLineRenderer : MonoCurveRenderer{}
```

## Technology
Expand All @@ -41,6 +45,16 @@ return transform.TransformPoint(worldVector);
transform.InverseTransformPoint(localVector);
```

### Differentiation

```C#
//AwayFromZero means that 12.5 -> 13
var units = (int)Math.Round(curve.Length * detail.unit, MidpointRounding.AwayFromZero);
var count = Mathf.Clamp(units, detail.min, detail.max);
differ = curve.Length / count;
return count;
```

### Calculus

```C#
Expand Down Expand Up @@ -97,30 +111,30 @@ Press and hold the ALT+SHIFT into InOutTangent Edit mode, drag the handle to adj
If the start and end points are close, they will stick together.
```


- Attach mono curve renderer component to the mono curve game object to renderer curve in scene.

- Evaluate point on the mono curve.

```C#
//Evaluate point on the mono curve at length.
var len = 0f;
var p0 = Target.Evaluate(len);
while (len < Target.Length)
var p0 = curve.Evaluate(len);
while (len < curve.Length)
{
len = Mathf.Min(len + 0.01f, Target.Length);
var p1 = Target.Evaluate(len);
len = Mathf.Min(len + 0.01f, curve.Length);
var p1 = curve.Evaluate(len);
//Just for demo, you can use p0,p1 to do more things.
Gizmos.DrawLine(p0, p1);
p0 = p1;
}

//Evaluate the curve at normalized time int the range[0,1].
//Evaluate point on the mono curve at normalized time int the range[0,1].
var t = 0f;
var p0 = EvaluateNormalized(t);
var p0 = curve.EvaluateNormalized(t);
while (t < 1.0f)
{
t = Mathf.Min(t + differ, 1.0f);
var p1 = EvaluateNormalized(t);
var p1 = curve.EvaluateNormalized(t);
//Just for demo, you can use p0,p1 to do more things.
Gizmos.DrawLine(p0, p1);
p0 = p1;
Expand Down
16 changes: 15 additions & 1 deletion UnityProject/Assets/MGS.Packages/Curve/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@
## Implemented

```C#
public abstract class MonoCurve : MonoBehaviour, IMonoCurve
public class MonoSinCurve : MonoCurve{}
public class MonoEllipseCurve : MonoCurve{}
public class MonoHelixCurve : MonoCurve{}
public class MonoBezierCurve : MonoCurve{}
public class MonoHermiteCurve : MonoCurve{}

public abstract class MonoCurveRenderer : MonoBehaviour, IMonoCurveRenderer{}
public class MonoCurveLineRenderer : MonoCurveRenderer{}
```

## Technology
Expand All @@ -41,6 +45,16 @@ return transform.TransformPoint(worldVector);
transform.InverseTransformPoint(localVector);
```

### Differentiation

```C#
//AwayFromZero means that 12.5 -> 13
var units = (int)Math.Round(curve.Length * detail.unit, MidpointRounding.AwayFromZero);
var count = Mathf.Clamp(units, detail.min, detail.max);
differ = curve.Length / count;
return count;
```

### Calculus

```C#
Expand Down Expand Up @@ -97,7 +111,7 @@ Press and hold the ALT+SHIFT into InOutTangent Edit mode, drag the handle to adj
If the start and end points are close, they will stick together.
```


- Attach mono curve renderer component to the mono curve game object to renderer curve in scene.

- Evaluate point on the mono curve.

Expand Down

0 comments on commit d0d5a38

Please sign in to comment.