BestFitPlanarSurfaces3Dworld does such a command exist?


#1

Hi,
V4 and V5

So as to explain this in simple terms, see attached test model, make the green surfaces best fit ZYplane and the blues best fit XY plane, but keeping them all grouped.

use to which I need to put this:-

I have an aircraft model brought in from a photogrammetry prog so the frame lines and stringers are a tad irrregular and slight wriggly.

Having created planar surfaces for these vertical frames and horizontal paired stringers (smaller frames that run fore/aft) I see that they are a not quite aligned to 3D world planes, what is the best way of getting Rhino to re-orient these to get a best fit to YZplane for the surfaces that should be in the YZplane.

Ditto those for XY.

NOTE…I need the aircraft fuselage to move along with the planar surfaces.

An ideal command would be something like my fictitious command BestFitPlanarSurfaces3Dworld

  1. group the model and planar surfaces
  2. select the planar surfaces to best fit to YZ, hit enter when done, or N if none
  3. select the planar surfaces to best fit to XY, hit enter when done, or N if none
  4. select the planar surfaces to best fit to ZY, hit enter when done, or N if none

model then realigns with best fit of planar surfaces to the 3D world.

somehow user must be able to select the surfaces within the grouping.

I end up with the aircraft 3D wireframe best fitting the 3D world. Fuselage frames upright and aircraft fuselage fore/aft datum aligned to grid.

For those interested in what happens next, I then select the first fuselage frame, use divide to generate points then interpolate curve through points to refine the curve, ProjectToCplane to flatten it. Move the resulting curve back to best fit on its planar surface. repeat for the other frames, then for stringers and end up with a refined aircraft 3D model.

SteveTestBestFitPlanarSrfs3Dworld.3dm (41.2 KB)


#3

Hi Steve,

To restate the problem as I understand it, you have a number of sets of curves which lie approximately on a series of YZ, XY and ZY planes. You want to orient each set of curves set precisely to the plane which runs through the average position of that set and is aligned to the world XYZ planes. Here is a possible workflow, which could probably be made into three scripts for the world planes.

  1. Create a layer for temporary helpers and make it current.
  2. Select a set of curves and run Group, then BoundingBox with Coordinates=World Output=Solid.
  3. SelLast or select the bounding box and then VolumeCentroid.
  4. Re-select the curve group and run SetPt, check the appropriate boxes and then pick the point from the VolumeCentroid command.
  5. Repeat for all curve sets, then delete the helper layer.

This workflow skips the step of creating the planer surfaces you have in your file. If you already have them, and the extents of the surfaces match the extents of the curves within the tolerance you need, you can skip the bounding box, select both the surface and curve set for the SepPt command, and then snap to the center of the plane.


#4

Here is a Python script you can try. It will try to find the nearest best fit plane through the object that is parallel to one of the principal planes and flatten the object to it. It is doing an auto-detection of the best fit plane, so you don’t need to choose - it finds the set of coordinates in X, Y, or Z with the least variation between min and max and assumes that is the plane desired.

You can input multiple points, pointclouds, curves and surfaces or any combination. All points will be considered as one object to pass a plane through, all other objects are processed individually.

As this is a Python script, it will only run in V5, not V4. It should also run on Mac.

–Mitch

ProjectToBestFitXYZPlaneAuto.py (2.9 KB)


#5

Hi Mark and Helvetosaur,
I shall try both methods.

I need the frames within my aircraft to not move independent of the aircraft, its not an exercise to re-orient these whilst aircraft stays put, I need them to act as guidance to re-orient the entire grouped aircraft unit to best fit the aircraft to XY and YZ planes.

Is this what both methods here aim to do ?

Cheers

Steve


#6

Steve,

No, the steps I outlined were aimed at flattening existing curves to a C-plane running through the average location of the curves, which is actually pretty similar to what you suggested in the last paragraph of your original post “ProjectToCplane to flatten it. Move the resulting curve back to best fit on its planar surface.”

It seems your first objective is simply to orient the aircraft to the grid. I would try to find or make snap-able centerlines of the aircraft from Top, Front and Right views, and then rotate the aircraft and centerline around one end point, with Ortho on, and snap the other end point to the Ortho snap. Repeat for each view. Once that is done, it will be easy to create the frames on the C-planes and then copy to all your locations.


(David Cockey) #7

Any reason not to use Orient3Pt instead of the individual rotations in each window?

My procedure for orienting imported point clouds of boats and similar is to create a line in the centerplane of the point cloud in the desired horizontal direction, and a second line which originates on the first line and points in the desired upward direction. The second line does not have to be exactly normal to the first line. Then I use Orient3Pt to orient the point cloud. Reference Pt 1 at the intersection of the two lines, Reference Point 2 at the end of the first line, and Reference Pt 3 at the end of the second line. Target Point 1 is where I want Reference Pt 1 to wind up, Target Pt 2 is in horizontal direction from Target Pt 1, and Target Pt 2 is somewhere above the line from Target Pt 1 to Target Pt 2.


#8

Nope. the discussion was to “planarize” “wiggly” curves, at least that’s what I thought it was about.

–Mitch


#9

Hi,

I am ok on how to make a planar surface through a pair of slightly wriggle curves that show e.g frame 10 on my aircraft.

The aircraft wireframe that results from photomodeler is one of curves for me not point clouds.

I NOW ATTACH THE FILE AS IT IS SO FAR.

I have orientated it roughly into place. The tall U shape is the rudder hinge frame, The S curves below are tail wheel well.

Curves are created in photomodeler by using marker spots then drawing curves through them with a common marker spot at curve start. The result will see a slightly wriggly curve for frame 10 port and another for frame 10 stbd. I use the Divide command then PlaneThroughPt to create a planar surface to best show the orientation of this frame and provide something to work with and see how the other frames compare as each will be a tad different. Frame 11 ditto the procedure and frame 12 ditto. Result sees each frame with its own idea on what its orientation should be.

As such creating a datum line is not possible until the three frames are best fit to ZYplane. If we use Fr10 planar surface to orient aircraft to ZY we find fr11 and fr12 are a bit out ! Clearly we need to take an average of the three (ok I have 6 in fact !) so best fit these planar surfaces with some command to ZYplane.

That done and with our aircraft at least upright now but listing to port a bit, we place planar surfaces using same Divide and PlaneThroughPt commands through any horizontal pairs of lines, finding three pairs of horizontal stringers port and stbd, I create three blue planar surfaces, now keeping the ZY alignment we need to use the horizontal planar surface to best fit to XY plane.

I envisage both alignments to happen at same time in a command, maybe we do it for ZY and then XY. I am happy either way as long as it works.

see the attached fictional file at start of the thread. The planar rectangles are what comes out of the process mentioned of creating planar surfaces, I havent drawn in the aircraft ! Their relationship to each other (and the aircraft if it was drawn) must survive, the task is to best fit them to XY and ZY planes.

see the fictional command and steps I wrote.

I now need to re-orientate the aircraft using these planar surfaces to best lock aircraft into a best fit in a 3D world.

No different than an aircraft datum on a plan when positioning a plan onto a grid in Rhino, one doesnt move the datum independent of the plan, the plan must move with it.

The process must move the entire aircraft and have the planar surfaces within it best fit to XY and ZY planes.

Somehow also a means of selecting the surfaces when the command says to do so, I am not sure, with the aircraft and planar surfaces grouped, how to select within a group, as I need the aircraft also selected. Maybe the command would require items ungrouped, have user indicate the planar surfaces, then have user select all.

Steve
BestFitAircraftPhotomodelerFrames.3dm (276.4 KB)


#10

Is there no way of using my planar surfaces in this attached file to help orient the aircraft to best fit ZY and XY planes ?
Steve


(David Cockey) #11

Is the actual aircraft exactly transversely symmetric across some plane? If so then use that as the XZ plane. If not then what would you select on the aircraft as closest to a plane of symmetry?

Is there a definition of level for the actual aircraft which would determine the XY plane? If so use it. Otherwise you need to decide.


#12

Steve,
I kind of agree with David about choosing the best frame; I know nothing about the photogrammetry process, but I assume there is some distortion in the perspective of the original source photographs. I would look for the frame with the least distortion and use that.

However, if I wanted an average of multiple planesTestBestFitPlanarSrfs3Dworld_Average Planes.3dm (95.7 KB)

I will leave it to Mitch to reduce this to a script :wink:


#13

Hi,
Definitely a script needed !
Nice tangible method in theory, but in practice its taking a lot of time…
One hour so far to take 6 vertical planar surfaces and reduce to 5 average verts, then take the 5 and create 4 average vertical
still to make 3 from the 4, 2 from the 3, 1 from the 2…

then there are the horizontals, I have 5 of those !..so thats 4 from the 5, 3 from the 4, 2 from the 3 and 1 from the 2 !!!

It makes visual sense but there has to be a quick Rhino way of establishing the average of the 6 vertical planar surfaces.

Now lets throw in something one shouldnt ignore. Standard deviation. the hill shaped curve from maths days at school.

if most of my planar surfaces sit within the middle of the hill, should I mess things up with allowing one out on the lowlands to have a say ?

If I measure the angle each surface has to the vertical and take an average of that, ignoring any large angles, I can rotate the aircraft by the average angle and get it oriented to the vertical, so a few clicks, a simple maths on calculator and job done.

That done, go to a view down onto it and get angles for how much the planar surfaces are swinging to port or stbd.
That done and aircraft rotated in that view to average, less any wild ones, go to view fwd at aircraft rear and see how much its listing to port or stbd, take angles and rotate to suit average, less any wild ones…

One for scripting !!!

David, aircraft is not symmetrical, except for last frame before tail unit. I cant take a planar surface midway between port and stbd frames. It might be that absolute rear base aft of tailwheel is on datum but not sure.

Steve