How to use Vector3D when Drawing a Box

Anonymous 9 years ago 0
This discussion was imported from CodePlex

AQSRanck wrote at 2014-07-01 20:31:

I want to draw a set of Boxes around the perimeter of a polygon, forming a "rim" around the polygon. My solution is to create a "RimVisual" to handle the task.

I have a list of points3D for each vertex of the polygon, and can easily find the vector3D for the next vertex by subtracting the previous point3D from the next point3D, giving me the length as well.

The first box would be added with an AddBox(StartPoint, X Double, Y Double, Z double). This works fine. The question is how to Add the next rim perimeter box?

Ideally, an addBox construct would require a StartPoint, Vector and XYZ Doubles, but none exists. So the question is how can I accomplish this with an existing constructor of the AddBox.

Or perhaps another tool is more suited.


objo wrote at 2014-07-02 13:11:

sorry, I don't understand the problem here.
Why can't you
foreach (var vertex in yourPolygon)
  yourMeshBuilder.AddBox(vertex, 1, 1, 1);

AQSRanck wrote at 2014-07-02 15:35:

In fact your comment is a very close description to what I did when I discovered the issue.

The boxes are arranged nicely around the perimeter but they are all aligned in the same direction.

What we want is for each box to start at one vertex and end at the next vertex.

I have some nice screen shots that illustrate my work in Helix, that I would like to share with you, but need advice on how to get them to you.


AQSRanck wrote at 2014-07-04 21:47:

This has to be so simple yet after several days of experimenting, I still cannot draw a set of boxes around the Perimeter of a Polygon, where each box starts at one vertex and ends at the next vertex.

The solution you propose draws a box at each vertex but even if the box is a long rectangle, does not allow the azimuth of the box to be oriented towards the next vertex.

Is there a tool that allows you to describe a start point and an end point for a Box (like a Pipe), or alternatively a feature that allows you to describe a start point, a vector , and xyz sizes for the box?

I have fooled around at length with the 4th construct on Box that uses a - - center Point , Vector, Vector, X Double, Y Double, Z Double, and Faces Enum. Since I don't know what this construct is intended to do, I get really crazy boxes, some with a side missing and some with sides drawn in very unusual places. So I suspect that this construct of the AddBox is not the answer.

AQSRanck wrote at 2014-07-23 15:23:

Problem solved. This may qualify as another "Rubber Ducky".
I work with 2D CAD (where the origin is the upper left) and have a really tough time in 3D changing the origin to the center of the figure - - - in my mind.

The first chapter of Petzolds book helped get me reoriented for 3D. The mystery of the crazy shapes (4th Construct of AddBox) was also solved in Petzolds book, where he introduced me to the "basis vectors". I built a tester project that allows you to change the values of points, vectors, and lengths with dependency properties for any of the Helix figures. It has turned out to be an invaluable as a tool to get my head around what is going on in 3D. It has also eliminated endless experimentation with values to see the effect.

When learning something new like 3D, the resources are rather slim, but Petzolds book should be everyone's primer.