|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
Renuka
Join Date: Aug 2017
Posts: 15
Rep Power: 7 ![]() |
If I have a plane, is there a quick way to get the normal vector? (just a simple plane, no surface, no edges or points).
def main(): # creating a plane x1,y1,z1=500,90,200 x2,y2,z2=50,100,200 x3,y3,z3=600,30,45 plane_1=base.CreateWplane3Points(x1,y1,z1,x2,y2,z2 ,x3,y3,z3) |
|
![]() |
![]() |
![]() |
![]() |
#2 |
New Member
Join Date: Sep 2017
Posts: 5
Rep Power: 7 ![]() |
Hi,
I am new to this forum. And glad to help you on this one. Function takes 3 point ordinates [x1,y1,z1],[x2,y2,z2],[x3,y3,z3]. And returns unit vector for the plane formed by the 3 points Code:
import ansa def normalVector2Plane(pnt1,pnt2,pnt3):# 3 points def vector(point1,point2): delx=point2[0]-point1[0] dely=point2[1]-point1[1] delz=point2[2]-point1[2] magnitude=(delx*delx+dely*dely+delz*delz)**0.5 # Distance from Distance Formula if(magnitude!=0): x=delx/magnitude y=dely/magnitude z=delz/magnitude return [x, y, z] # Unit Vecor else: return 0 a = vector(pnt1, pnt2) b = vector(pnt1, pnt3) return ansa.calc.CrossProduct(a, b) # Cross Product of 2 Vectors |
|
![]() |
![]() |
![]() |
![]() |
#3 | |
New Member
Renuka
Join Date: Aug 2017
Posts: 15
Rep Power: 7 ![]() |
Quote:
|
||
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to make a code parallel? | Bruno Machado | Fluent UDF and Scheme Programming | 15 | May 27, 2016 10:18 |
[foam-extend.org] Installing foam-extend 3.1 on Ubuntu 14.04 | stephie | OpenFOAM Installation | 16 | April 23, 2015 17:18 |
CFX problem in ubuntu (linux) | Vigneshramaero | CFX | 0 | July 13, 2012 11:22 |
Normal vector, slope and aspect angle | g_niro | Main CFD Forum | 0 | February 2, 2011 18:24 |
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug | unoder | OpenFOAM Installation | 11 | January 30, 2008 21:30 |