stippled line variable point spacing from raster
 1-12  13-32  33-52  53-60

Previous
Next
 From:  bemfarmer
10809.33 
Given a (continuous) curve in an ( x, y ) plane, which goes from xMin to xMax, and which for every x, has a single y value.
(Like for a single valued function.)
A circle and ellipse do not qualify. The bottom half of a circle would qualify.


How to Array the start point along the curve, with constant x intervals.
I do not think that there is a script for doing this?
ArrayCurve of startpoint of the curve usually is spaced differently.

This can be done by placing a horizontal line below the curve, and using ArrayCurve to array the startpoint of the line along the line, and then projecting the points to the "single valued curve".

- Brian
  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
10809.34 In reply to 10809.33 
Hi Brian,

re:
> How to Array the start point along the curve, with constant x intervals.

Probably you'd need to create a vertical line at every x position and then use the 'intersect' factory (see Intersect.js) to intersect the line with your function curve, that should generate a point object.

- 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:  bemfarmer
10809.35 In reply to 10809.34 
Hi Michael,

Intersections is a good idea.

Create guide line above curve, and guide line below curve.
Run LineWeb to get uniform deltaX lines between the two guide lines.
Intersect lines with curve to create points on the curve.
Investigate the order of the points.

Look for algorithm to scan the points on a curve, from curve start to curve end, and place the points in ordered array.
This could then apply to curves which loop back .
(Unless MoI already orders the points along a curve?)

- Brian
  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
10809.36 In reply to 10809.35 
Hi Brian,

re:
> Look for algorithm to scan the points on a curve, from curve start to curve end, and
> place the points in ordered array.
> This could then apply to curves which loop back .
> (Unless MoI already orders the points along a curve?)

In your script you can call intersect separately for each vertical line with the function curve
and since you are making those vertical lines you should generate them in increasing order
so that your intersections will be ordered also.

- 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:  bemfarmer
10809.37 In reply to 10809.36 
Thank you Michael.

I have been getting some really weird results, with LineWeb and Intersect commands.
Intersections are sometimes double points, or for a curve crossing itself, 3 points.

Either my curves are weird, or a bug?

I'll post a .3dm later.
  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:  bemfarmer
10809.38 In reply to 10809.37 
If I rebuild the looped curve, the "double" intersection problems go away.

If I separate a fresh curve, or a rebuilt curve, and then (re) Join it,
then the Intersect script causes "double" intersect points.

It seems like the intersect script is detecting pre-join curve segments???

Sometimes the crossover yields 3 points from intersect.

- Brian

ps I think my mouse has been acting a little strange lately, so I gave it a rap on the mousepad :-)
Seems to have helped with mouse selection.

  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
10809.39 In reply to 10809.38 
Hi Brian, I'm a little confused because previously you wrote:

> Given a (continuous) curve in an ( x, y ) plane, which goes from xMin to xMax, and which for every x, has a single y value.
> (Like for a single valued function.)
> A circle and ellipse do not qualify. The bottom half of a circle would qualify.

But all of the curves you just posted are not function curves like that.

- 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:  bemfarmer
10809.40 In reply to 10809.39 
Hi Michael,

The initial curve was traveling from left to right, without curving back above previous portion, for which it is "easier" to find constant deltaX points.

Since then, I have been trying to extend the curve with it "looping" back, a more difficult curve to place constant deltaX point on.
So I did a bit of experimenting.

A curve crossing over itself, (e.g. figure eight) might be more difficult yet.

Anyway, then I inadvertently trimmed the curve with many lineweb lines, and rejoined it, (without being very aware)
Then the "double" intersect points problem occurred.

Attached is a "left to right" curve, which was trimmed to segments, and rejoined.
The double intersect points problem also occurs with this curve.

I have always thought that a re-Joined curve was the same as the initial single curve, but there must be some difference?
So the curve "remembers" is former segments, unless Rebuild is used?

- Brian

Another thought was that MoI joins curve segments "head to tail", and so apparently knows the sequential order of end points and start points.

Google search of "sort points on curve algorithm" did not seem to be very fruitful.

hmm, I see that spell checker is working on editing posts.

(So I thought I should report an unexpected (for myself) result.)

EDITED: 16 Aug 2022 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:  bemfarmer
10809.41 In reply to 10809.40 
Projecting 10 points on the bottom line, up to the (10 segments but rejoined) curve, also results in 18 points.
( 2 times 8) + 2.
As if each former curve segment is being projected to.
(Same result as intersect.)

- Brian

(I thing MoI4 had similar results, a very brief test.)
  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
10809.42 In reply to 10809.40 
Hi Brian, I'll see if I can get the Intersect command to weed out duplicate intersections. For the current version I guess you would need your script to do that itself.

re:
> I have always thought that a re-Joined curve was the same as the initial single curve, but there must be some difference?
> So the curve "remembers" is former segments, unless Rebuild is used?

Yes Join on curves will generate a parent curve that has a list of head to tail segments in it. It doesn't automatically merge segments together. So if you use Edit > Separate on it it should break apart into the same pieces you had before using Join.

In v5 you can use the Merge command on it to merge segments that meet smoothly into longer segments.

- 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:  bemfarmer
10809.43 In reply to 10809.42 
Thank you Michael.

Merge improvement is good to know.

Using Merge just now, in MoI5beta, and the intersection came out correct.
And Project of bottom line points also came out correct.

One last observation for tonight: MoI5beta:
Using the last .3dm, with 10 vertical LineWeb lines:
(Without Merge)
If the re-joined curve is shifted over a bit, so the LineWeb lines do not intersect the former segment ends,
the intersect occurs correctly, (but of course in different locations.)

- Brian

As expected, Merge does not help with getting correct Intersections or Projections, in MoI4,
(in the current situation anyway).

EDITED: 16 Aug 2022 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:  pressure (PEER)
10809.44 In reply to 10809.43 
Brian,

I've also noticed that Construct > Curve > Isect sometimes gives multiple points when I'm expecting 1. For example, if I draw 3 lines through the origin (by using Grid Snap), select the 3 lines, and run Isect, I get 3 points:

I worried that maybe the redundant points would be at locations around .001 units apart http://moi3d.com/forum/lmessages.php?webtag=MOI&msg=8468.19, so I ran
code:
var pts = moi.geometryDatabase.getSelectedObjects().getPoints();

for ( var i = 0; i < pts.length; ++i )
{
	moi.ui.alert
	(
		'point ' + i + '\n' +
		'x = ' + pts.item(i).pt.x + '\n' +
		'y = ' + pts.item(i).pt.y + '\n' +
		'z = ' + pts.item(i).pt.z + '\n'
	)
}


(Is there an easier way to get accurate point coordinates?)

But, In the case of the location where the curve crosses over itself in WeirdIntersectionOne.3dm

I see that 2 of the points are in exactly the same location and the 3rd is only different along y in the 13th decimal place:

point 0
x = 20.826530612244895
y = 37.74721822498999
z = 0

point 1
x = 20.826530612244895
y = 37.74721822498999
z = 0

point 2
x = 20.826530612244895
y = 37.747218224989986
z = 0

In the example with straight lines above all 3 points are at 0,0,0. I tried moving one of the lines by only .0001 units, thinking that this might cause problems, but the 3 intersection points created look to be at exactly the right locations:

- Peer

  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:  bemfarmer
10809.45 In reply to 10809.44 
Hi PEER

A brief partial reply on lunch break:

I use the script _PointCoordinates3, which is ParseFloat to 6 decimal places, and does one point at a time.
I think it uses the same data as your script.

I've read in the past that computer binary representations of real numbers are not perfect. They only go to, or are accurate to, a certain number of decimals. The programmer does the best that they can...

3 points sounds like the combination of 3 things, taken two at a time.

I figured that "crossing over" might cause some type of problem.

- Brian
  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:  pressure (PEER)
10809.46 In reply to 10809.45 
Brian,

Thanks for developing _PointCoordinates3. I just took it for a spin and like it.

- Peer

I didn't mean to imply that a difference in the 13th decimal place is a problem. That seems very good to me. Also, this multiple points at an intersection thing hasn't actually caused me any problems.
  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:  bemfarmer
10809.47 In reply to 10809.46 
Thankyou.
The script had help from about 3 other people, including Michael
- Brian
  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:  bemfarmer
10809.48 
The RemoveDuplicates command appears at the top of CustomUI scripts screen.
As of MoI4, it removes duplicate points as well as duplicate curves...
The RemoveDuplicates script appears in the MoI4 or MoI5beta commands folder, not in AppData commands folder.

I may be mistaken, but other than CustomUI, MoI does not have a way to see these "extra" commands, like Flip, Make2D, Merge, Rebuild, RemoveDuplicates, etc.


Michael's SelectDuplicates script also finds duplicates, and can allow the user to delete the found duplicates as well.
And it has a tolerance.
https://moi3d.com/forum/index.php?webtag=MOI&msg=7782.8
I just added it to my add-on scripts in AppData.
I suppose that it could be added to the top of CustomUI scripts screen...

- Brian
  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:  bemfarmer
10809.49 
Draft:
Preliminary outline of script to order pre-existing points on a curve.
The result would be an array or objectlist of the points, in order
from the curve startPt to its endPt. (Flip option?)

Select the curve.
Clone the curve.
MoI5beta: Merge the cloneCurve, to get rid of any former segmentation.
(The cloneCurve probably cannot cross over itself?, or else do...?)

Select the points on the curve.
Remove duplicate points.
Select the desired start point of the cloneCurve.
Compare desiredStartPt with actual startPt of the cloneCurve and Flip cloneCurve if necessary.
Trim cloneCurve with the pre-existing points.
Get the segments, which will be in order from start to end of curve.
Place desiredStartPt in orderedPtList objectlist.
Get the endPt of all of the segments, one by one, and place them in orderedPtLIst.

Delete cloneCurve

- Brian

Maybe there is a better way, or MoI already can order points on a curve?
  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
10809.50 In reply to 10809.49 
Hi Brian,

re:
> Maybe there is a better way, or MoI already can order points on a curve?

You can use the dropPoint( pt ) function on a curve or curvesegment. Given a 3D point it will return a number for the parameter value in the curve's domain. You could then sort by the parameter values in ascending order.

It may be problematic if you have a self intersection though and if you are trying to drop a point right at that self intersection.

- 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:  Larry Fahnoe (FAHNOE)
10809.51 In reply to 10809.48 
Hi Brian,

> I may be mistaken, but other than CustomUI, MoI does not have a way to see these "extra" commands, like Flip, Make2D, Merge, Rebuild, RemoveDuplicates, etc.

I'm somewhat of a minimalist when it comes to making changes to MoI's UI, so rather than using CustomUI, I borrowed Max's Scripts menu and made a stand-alone version called Extras: https://moi3d.com/forum/index.php?webtag=MOI&msg=10353.1 which then makes it easy to see the "extra" builtin commands as well as those that have been added.

--Larry
  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:  Frenchy Pilou (PILOU)
10809.52 In reply to 10809.51 
Have you an image of the UI result ?
---
Pilou
Is beautiful that please without concept!
My Moi French Site My Gallery My MagicaVoxel Gallery
  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-12  13-32  33-52  53-60