Line order and direction
 1-16  17-21

Previous
Next
 From:  bemfarmer
9781.17 In reply to 9781.16 
Using a right handed helix as an example of the initial curve, say a threaded rod:
Consider an arbitrary point on the helix.
Rotate of the rod, or have the point travel along the helix.
Whether the point is traveling cw or ccw, or..., depends upon the view.
But the curve remains right handed.

- Brian

Maybe use tangent as view direction?

normal and binormal?

I do not understand the cw, ccw question. Maybe some other criterion is needed?

EDITED: 16 Sep 2020 by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  wayne hill (WAYNEHILL5202)
9781.18 In reply to 9781.17 
Hi Brian,

I am working on a project to draw MoI objects to a html canvas.

The html arcs/circles use clockwise and counterclockwise to determine the start and end direction of the arc.

https://www.w3schools.com/tags/canvas_arc.asp

The direction of the arc would also be used within a path for a motion controller. or simple G Code output for CNC machines.

I tried using a cross product from the points. My program logic did not work for some reason. Looking for a rotational cross product for better results.

Thank you,
Wayne
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
9781.19 In reply to 9781.16 
Hi Wayne, are these arcs all in the world x/y plane (the Top view's plane)?

So the concept of being CW or CCW is with respect to a plane normal, so I think you'll need to incorporate that.

See if this makes sense:


So you have a point on the arc, and the tangent vector. Make a second vector from the point on the arc to the arc's center point.

If you now take the CrossProduct( tangent, towards_center_vector ), that will generate a normal, either the same as your plane normal for the CCW arc, or opposite it for the CW arc. When comparing normals it's not a good idea to test for total equality, due to tiny roundoffs in floating point mathematics you can easily end up with values like 0.00000000000001 instead of 0, so you want to allow some epsilon/tolerance slack in your test.

Something like:

var eps = 1.0e-10;

function IsEqual( x, y )
{
    return Math.abs( x - y ) < eps;
}

function IsEqual( vec1, vec2 )
{
    return IsEqual( vec1.x, vec2.x ) && IsEqual( vec1.y, vec2.y ) && IsEqual( vec1.z, vec2.z );
}

Or another way you can compare normalized vectors is by dotproduct between them which gives the cosine of the angle between them. So something like

function VectorsAreSameDir( vec1, vec2 )
{
return DotProduct( vec1 /*normalized*/, vec2 /*normalized*/ ) > 0.99984769515639123915 (this number is the cosine of 1 degree).
}

Let me know if that doesn't do what you need.

- Michael

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
9781.20 In reply to 9781.16 
Hi Wayne, another way you can determine the direction just using 2D points is to make a 2D triangle and then compute the signed area of the triangle:
https://www.quora.com/What-is-the-signed-Area-of-the-triangle?share=1

It will be a positive number for CCW, and a negative number for CW.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  wayne hill (WAYNEHILL5202)
9781.21 In reply to 9781.19 
Hi Michael,

Yes, I am only using the top view plane. The methods you suggested will be looked at in closer detail.

Thank you.
Wayne
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages:  1-16  17-21