Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

RE: [V8i VBA] Detecting if coordinate is above or below target element

$
0
0

Thanks for the compliment. It has been quite enjoyable but sometimes a headache as well.

[quote user="Jon Summers"]

Excel includes some matrix functions.  This web page describes Excel 2010 Matrix Multiplication (MMULT).

[/quote]

I actually discovered that function this morning and have implemented it in the spreadsheet as can be seen in formula view:

The purpose of the spreadsheet is so I have something that I know provides the correct vector & cross product values and can check against the values displayed in the locals/watch windows. Getting back to relevance of programming, I currrently posses little knowledge of the many functions/methods for working with point3d/vectors/rotation matrices and which of those is best to use for a given task. However, from the few I have used or read in the VBA help the following sequence is what I have come up with which will hopefully bring me to my end goal of determining which side of the target element a coordinate/point is located.

  1. I will be using a locator class with ILocateCommandEvents  to select the target element which will be converted to a b-spline curve to aid calculations.
  2. Using known coordinates, use ProjectPointOnPerpendicular to calculate the coordinate of the perpendicular intersection with selected element.
  3. Use EvaluatePointAtDistance with the new intersection coordinate calculated in 2. so we can determine the intersection coordinates parameter value (u iirc?)
  4. Use EvaluatePointFrame using u so we can access the normal and tangent vectors for the intersection coordinate.
  5. With the vectors yielded at 5. calculate the cross product using Point3dCrossProduct (though I think the binormal property in EvaluatePointFrame is the same thing? If so no need for step 5)

Seems long-winded and I don't yet know if it will work or if its going to fail somewhere along the way due to a misunderstanding on my part of what a particular function does. I'd like to think there is a far simpler approach but not knowing many of the methods available, I don't know it.


Viewing all articles
Browse latest Browse all 7260

Trending Articles