I would like to be able to define an Offset Plane (A plane parallel to another plane, a given distance from it). The planes I'm using are all defined as a Normal Vector and a point on the plane, V0. So the distance would be measured along the plane normal.
Offset Plane?
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Offset Plane?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Offset Plane?
NewPosition = OldPosition + Distance * NormalizedVector
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Offset Plane?
Hi Samuel
How does that actually work?
[/size]
How does that actually work?
Code: Select all
EnableExplicit
Structure pt3d
x.d
y.d
z.d
EndStructure
Structure vector3d
x.d
y.d
z.d
EndStructure
Structure plane3d
VecNorm.vector3d
PtV0.pt3d
EndStructure
Global OrgPlane.plane3d
Global OffPlane.plane3d
Global dOffset.d
Procedure OffsetPlane(*OffsetPlane.plane3d, *OrginalPlane.plane3d, dOffset.d)
;#---------------------------------------------------------------------------
*OffsetPlane\VecNorm\x = *OrginalPlane\VecNorm\x
*OffsetPlane\VecNorm\y = *OrginalPlane\VecNorm\y
*OffsetPlane\VecNorm\z = *OrginalPlane\VecNorm\z
*OffsetPlane\PtV0\x = (*OrginalPlane\PtV0\x + dOffset) * *OrginalPlane\VecNorm\x
*OffsetPlane\PtV0\y = (*OrginalPlane\PtV0\y + dOffset) * *OrginalPlane\VecNorm\y
*OffsetPlane\PtV0\z = (*OrginalPlane\PtV0\z + dOffset) * *OrginalPlane\VecNorm\z
EndProcedure
OrgPlane\VecNorm\x = 0.000000
OrgPlane\VecNorm\y = -0.693439
OrgPlane\VecNorm\z = 0.720515
OrgPlane\PtV0\x = 2.007707
OrgPlane\PtV0\y = -19.221010
OrgPlane\PtV0\z = 13.384741
dOffset = 11.55
OffsetPlane(OffPlane, OrgPlane, dOffset)
Debug "OffPlane\VecNorm\x = " + StrD(OffPlane\VecNorm\x, 6)
Debug "OffPlane\VecNorm\y = " + StrD(OffPlane\VecNorm\y, 6)
Debug "OffPlane\VecNorm\z = " + StrD(OffPlane\VecNorm\z, 6)
Debug " OffPlane\PtV0\x = " + StrD(OffPlane\PtV0\x, 6)
Debug " OffPlane\PtV0\y = " + StrD(OffPlane\PtV0\y, 6)
Debug " OffPlane\PtV0\z = " + StrD(OffPlane\PtV0\z, 6)
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Offset Plane?
You need to get rid of the parenthesis in your procedure because the multiplication of the distance and normal vector has to happen first.
Try this.
Try this.
Code: Select all
*OffsetPlane\PtV0\x = *OrginalPlane\PtV0\x + dOffset * *OrginalPlane\VecNorm\x
*OffsetPlane\PtV0\y = *OrginalPlane\PtV0\y + dOffset * *OrginalPlane\VecNorm\y
*OffsetPlane\PtV0\z = *OrginalPlane\PtV0\z + dOffset * *OrginalPlane\VecNorm\z
-
- Always Here
- Posts: 6425
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Offset Plane?
...ah yes, that's it thanks!
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.