Translating 3D Axis Question - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Translating 3D Axis Question

First post...

I am not asking for someone to do my work, rather I am new to the whole 3D coding world and need some general guidelines on how to proceed as well as a primer on the conceptual logic....

Any response would be greatly appreciated...


I am writing a program that takes output from a CAD program and translates it into real world information usable for the purpose of creating materials estimates for the construction of wood frame buildings.

The CAD program creates a virtual frame of the structure including the studs, plates, headers, jacks, cripples, joists, rafters etc. These are the parts that make up a wood frame building. I am able to export the vector data from the back engine of the cad program as a text file and parse the data into an object oriented library that models the real worlds parts virtually.

The fixed base coordinate system defines the drawing space x axis as 1,0,0 and the y axis as 0,1,0. The z axis is not defined in the the data output and is assumed always through out the the program as 0,0,1. Translated into a real world sense from the viewers perspective, looking away from you is negative Z, looking up is positive Y, and looking right is positive X.

Each entity created has its own transform matrix for x and y, that is to say they have rotational matrix for their positive x and y axis. As an example, if drawing in plan view (looking straight down the y axis), and drawing a line from lower left to upper right on the screen (that would be North East in the real world sense), entity matrix would be x 1,0,-1, and y 0,1,0.

So far this pretty much follows all of the normal programming rules from what I have gathered:


Where I need a little help and guidance is as follows:

Each of the entities (pieces of wood) have rules for their creation that let me apply rules or assumptions to them to extract the relevant data I need to form my materials lists, cutting lists etc.

Without getting into to much detail an example would be that a stud in a wall is always assumed to have the following corresponding relationships: x-axis = thickness, z-axis = width, and y-axis equals height or length.

The CAD output stores all of the data for the polygons that make up the stud in real world coordinates, but unfortunately there is no convention to either the order of the polygons, their lines and the points that make up the lines; its simply a jumble or so it appears. In other words the polygons are not listed like: bottom, top, left face, right face, rear face, front face...they constantly change order.

Bear with me I am almost done....

Here is some sample data of the stud object. This stud is in a wall drawn from South West to North East in a plan view at a 45 degree angle (positive x rotated -45 degrees)...OBJECT st5 is the stud...the data for this stud is broken out into both the entity object and its primitives...


| +--- BLOCK: fram
| | E-space-base: 8'9_7/8",0',-9'8_7/16"
| | E-space-x: 8_1/2",0',-8_1/2"
| | E-space-y: 0',1',0'
| |
| |--- OBJECT: st5 reflectance:100 gloss:15 diffusion:100
| | E-space-base: 11'7_5/16",1_1/2",-12'5_7/8"
| | E-space-x: 8_1/2",0',-8_1/2"
| | E-space-y: 0',1',0'
| | T-space-base: 8'9_7/8",0',-9'8_7/16"
| | T-space-x: 8_1/2",0',-8_1/2"
| | T-space-y: 0',1',0'


object: st5
polygon(1) fill-color: 247 r228g207b156
line(2) point1: 11'7_5/16",1_1/2",-12'5_7/8" point2: 11'7_5/16",9'4_1/4",-12'5_7/8"
line(3) point1: 11'7_5/16",9'4_1/4",-12'5_7/8" point2: 11'4_13/16",9'2_1/2",-12'8_3/8"
line(4) point1: 11'4_13/16",1_1/2",-12'8_3/8" point2: 11'4_13/16",9'2_1/2",-12'8_3/8"
line(5) point1: 11'7_5/16",1_1/2",-12'5_7/8" point2: 11'4_13/16",1_1/2",-12'8_3/8"
polygon(6) fill-color: 247 r228g207b156
line(7) point1: 11'8_3/8",9'4_1/4",-12'6_15/16" point2: 11'8_3/8",1_1/2",-12'6_15/16"
line(8) point1: 11'8_3/8",1_1/2",-12'6_15/16" point2: 11'5_7/8",1_1/2",-12'9_7/16"
line(9) point1: 11'5_7/8",9'2_1/2",-12'9_7/16" point2: 11'5_7/8",1_1/2",-12'9_7/16"
line(10) point1: 11'5_7/8",9'2_1/2",-12'9_7/16" point2: 11'8_3/8",9'4_1/4",-12'6_15/16"
polygon(11) fill-color: 239 r128g255b128
line(12) point1: 11'5_7/8",9'2_1/2",-12'9_7/16" point2: 11'4_13/16",9'2_1/2",-12'8_3/8"
line(13) point1: 11'7_5/16",9'4_1/4",-12'5_7/8" point2: 11'4_13/16",9'2_1/2",-12'8_3/8"
line(14) point1: 11'7_5/16",9'4_1/4",-12'5_7/8" point2: 11'8_3/8",9'4_1/4",-12'6_15/16"
line(15) point1: 11'5_7/8",9'2_1/2",-12'9_7/16" point2: 11'8_3/8",9'4_1/4",-12'6_15/16"
polygon(16) fill-color: 247 r228g207b156
line(17) point1: 11'7_5/16",1_1/2",-12'5_7/8" point2: 11'7_5/16",9'4_1/4",-12'5_7/8"
line(18) point1: 11'8_3/8",1_1/2",-12'6_15/16" point2: 11'7_5/16",1_1/2",-12'5_7/8"
line(19) point1: 11'8_3/8",9'4_1/4",-12'6_15/16" point2: 11'8_3/8",1_1/2",-12'6_15/16"
line(20) point1: 11'7_5/16",9'4_1/4",-12'5_7/8" point2: 11'8_3/8",9'4_1/4",-12'6_15/16"
polygon(21) fill-color: 247 r228g207b156
line(22) point1: 11'5_7/8",9'2_1/2",-12'9_7/16" point2: 11'5_7/8",1_1/2",-12'9_7/16"
line(23) point1: 11'5_7/8",1_1/2",-12'9_7/16" point2: 11'4_13/16",1_1/2",-12'8_3/8"
line(24) point1: 11'4_13/16",1_1/2",-12'8_3/8" point2: 11'4_13/16",9'2_1/2",-12'8_3/8"
line(25) point1: 11'5_7/8",9'2_1/2",-12'9_7/16" point2: 11'4_13/16",9'2_1/2",-12'8_3/8"
polygon(26) fill-color: 247 r228g207b156
line(27) point1: 11'8_3/8",1_1/2",-12'6_15/16" point2: 11'7_5/16",1_1/2",-12'5_7/8"
line(28) point1: 11'7_5/16",1_1/2",-12'5_7/8" point2: 11'4_13/16",1_1/2",-12'8_3/8"
line(29) point1: 11'5_7/8",1_1/2",-12'9_7/16" point2: 11'4_13/16",1_1/2",-12'8_3/8"
line(30) point1: 11'8_3/8",1_1/2",-12'6_15/16" point2: 11'5_7/8",1_1/2",-12'9_7/16"

The 3D solid data I have extracted relevant to this stud st5 object comes in as series of 6 polygons each with 4 lines and each line with 2 points stored in real world data. Obviously this is a huge waste of run time memory, so I have taken the data stripped out all redundant information to create a virtual 3D solid with a collection of faces, a collection lines and a collection of points such that I now have 6 faces, 12 lines and 8 points. This of course assumes the solid is a simple 3D rectangle type object.

Finally and why I came here to this forum:

Assuming my stud is a simple rectangular solid, rotated -45 degrees, and that its x-axis = thickness, z-axis = width, and y-axis equals height or length, what would be the most efficient way to extract thickness, width and length?

Catch: The stud may or may not be a simple solid axial planes. The bottom or top cut may hay have a simple bevel or miter, or in fact be a compound cut (that is to say the cut plane shares no axis of the relative coordinate system of its parent solid.

Sorry for the long winded preface...but I thought it necessary to expose as many of my assumptions as possible in hopes thaty flaws in my initial logic might be pointed out and that any responses given are as educational as they are tactical solutions.

I need help with my strategy as much as my tactics...

Thank you....

Carson Wales

Sign In or Register to comment.