本文整理汇总了C#中Engine3D.Vector3d类的典型用法代码示例。如果您正苦于以下问题:C# Vector3d类的具体用法?C# Vector3d怎么用?C# Vector3d使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector3d类属于Engine3D命名空间,在下文中一共展示了Vector3d类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ctl3DView
public ctl3DView()
{
InitializeComponent();
//Visible = false;
//SetupSceneTree();
m_modelAnimTmr = null;
m_camera = new GLCamera();
m_axisCam = new GLCamera();
ResetCameraView();
m_isectnormal = new Engine3D.Vector3d();
mainViewSplitContainer.Panel1Collapsed = true;
UVDLPApp.Instance().m_undoer.AsociateUndoButton(buttUndo);
UVDLPApp.Instance().m_undoer.AsociateRedoButton(buttRedo);
//glControl1. = new GraphicsMode(GraphicsMode.Default.ColorFormat, GraphicsMode.Default.Depth, 8);
gr2d = UVDLPApp.Instance().m_2d_graphics;
ctlBgndList = new List<ctlBgnd>();
guiconf = UVDLPApp.Instance().m_gui_config;
guiconf.TopLevelControl = mainViewSplitContainer.Panel2;
UpdateButtonList();
//guiconf.LoadConfiguration(global::UV_DLP_3D_Printer.Properties.Resources.GuiConfig);
RearrangeGui();
// toplevel controls must point to this
glControl1.PaintCallback += new ctlGL.delPaint(DisplayFunc);
m_sliceTex = -1;
RegisterCallbacks();
UVDLPApp.Instance().m_slicer.Slice_Event += new Slicer.SliceEvent(SliceEv);
UVDLPApp.Instance().AppEvent += new AppEventDelegate(AppEventDel);
}
示例2: Dot
//dot product
public double Dot(Vector3d v)
{
double dp = ( x * v.x ) +
( y * v.y ) +
( z * v.z );
return dp;
}
示例3: ctl3DView
public ctl3DView()
{
InitializeComponent();
//Visible = false;
//SetupSceneTree();
m_modelAnimTmr = null;
m_camera = new GLCamera();
m_axisCam = new GLCamera();
ResetCameraView();
m_isectnormal = new Engine3D.Vector3d();
mainViewSplitContainer.Panel1Collapsed = true;
UVDLPApp.Instance().m_undoer.AsociateUndoButton(buttUndo);
UVDLPApp.Instance().m_undoer.AsociateRedoButton(buttRedo);
//glControl1. = new GraphicsMode(GraphicsMode.Default.ColorFormat, GraphicsMode.Default.Depth, 8);
gr2d = UVDLPApp.Instance().m_2d_graphics;
ctlBgndList = new List<ctlBgnd>();
guiconf = UVDLPApp.Instance().m_gui_config; // set from the main program GUIConfig
guiconf.TopLevelControl = mainViewSplitContainer.Panel2;
UpdateButtonList();
RearrangeGui(); // once the GUIConfig is loaded from the plugins and from the main GUIConfig, the screen is re-arranged
// toplevel controls must point to this
glControl1.PaintCallback += new ctlGL.delPaint(DisplayFunc);
m_sliceTex = -1;
RegisterCallbacks();
UVDLPApp.Instance().m_slicer.Slice_Event += new Slicer.SliceEvent(SliceEv);
UVDLPApp.Instance().AppEvent += new AppEventDelegate(AppEventDel);
}
示例4: Dot
public double Dot(Vector3d v) //dot product
{
double dp = ( x * v.x ) +
( y * v.y ) +
( z * v.z );
return dp;
}
示例5: Cross
public Vector3d Cross(Vector3d v)
{
Vector3d cr = new Vector3d();
cr.x = y * v.z - z * v.y;
cr.y = z * v.x - x * v.z;
cr.z = x * v.y - y * v.x;
return cr;
}
示例6: Polygon
public bool m_wire; // draw wireframe
#endregion Fields
#region Constructors
public Polygon()
{
m_normal = new Vector3d();
m_color = Color.Gray;
m_linecolor = Color.Blue;
m_solid = true;
m_wire = true;
m_center = new Point3d();
}
示例7: IntersectObjects
public static List<ISectData> IntersectObjects(Vector3d direction, Point3d origin, List<Object3d> objects, bool supports)
{
//List<ISectData> m_isectlst = new List<ISectData>();
try
{
if (!vecinit)
{
Initvecs();
}
m_isectlst.Clear();
direction.Normalize();
direction.Scale(10000.0f);
IOendp.Set(origin);
IOendp.x += direction.x;
IOendp.y += direction.y;
IOendp.z += direction.z;
lock (lck)
{
foreach (Object3d obj in objects)
{
if (obj.tag == Object3d.OBJ_SUPPORT && !supports)
continue;
// try a less- costly sphere intersect here
if (IntersectSphere(origin, IOendp, ref IOintersect, obj.m_center, obj.m_radius))
{
foreach (Polygon p in obj.m_lstpolys)
{
//IOintersect = new Point3d();
// try a less- costly sphere intersect here
if (IntersectSphere(origin, IOendp, ref IOintersect, p.m_center, p.m_radius))
{
// if it intersects,
if (RTUtils.IntersectPoly(p, origin, IOendp, ref IOintersect))
{
m_isectlst.Add(new ISectData(obj, p, IOintersect, origin, direction));
}
}
}
}
}
}
ISectData gp = ISectGroundPlane(direction, origin);
if (gp != null)
{
m_isectlst.Add(gp);
}
m_isectlst.Sort();
}
catch (Exception ex)
{
DebugLogger.Instance().LogError(ex.Message);
}
return m_isectlst;
}
示例8: GLCamera
public GLCamera()
{
viewmat = new Matrix3D();
deg2rad = (float)(2.0 * Math.PI / 360.0);
m_zaxis = new Vector3d(0, 0, 1);
m_dx = m_dy = m_dz = 0;
m_dir = 1.0f;
m_bvscalexy = 4.0f;
m_bvscaleh = 1.2f;
}
示例9: Vector3d
static Vector3d newlen = new Vector3d(); // for calculating the radius of this poly
#endregion Fields
#region Constructors
public Polygon()
{
m_normal = new Vector3d();
m_radius = 0.0f;
m_color = Color.Gray;
m_center = new Point3d();
m_minmax = new MinMax(); // really should be bounding box
m_hidden = false;
tag = TAG_REGULAR;
}
示例10: ctl3DView
public ctl3DView()
{
InitializeComponent();
//SetupSceneTree();
m_modelAnimTmr = null;
m_camera = new GLCamera();
ResetCameraView();
m_isectnormal = new Engine3D.Vector3d();
ctlViewOptions.TreeViewHolder = mainViewSplitContainer;
ctlViewOptions.LayerNumberScroll = numLayer;
ctlViewOptions.ObjectInfoPanel = objectInfoPanel;
ctlViewOptions.SceneControl = ctlScene1;
mainViewSplitContainer.Panel1Collapsed = true;
UVDLPApp.Instance().m_undoer.AsociateUndoButton(buttUndo);
UVDLPApp.Instance().m_undoer.AsociateRedoButton(buttRedo);
//glControl1. = new GraphicsMode(GraphicsMode.Default.ColorFormat, GraphicsMode.Default.Depth, 8);
gr2d = UVDLPApp.Instance().m_2d_graphics;
ctlBgndList = new List<ctlBgnd>();
guiconf = UVDLPApp.Instance().m_gui_config;
guiconf.TopLevelControl = mainViewSplitContainer.Panel2;
UpdateButtonList();
guiconf.LoadConfiguration(global::UV_DLP_3D_Printer.Properties.Resources.GuiConfig);
RearrangeGui();
ctlObjScale.c3d = this;
ctlObjRotate.c3d = this;
ctlObjMove.c3d = this;
ctlSupport.c3d = this;
objectInfoPanel.c3d = this;
ctlViewOptions.c3d = this;
ctlMeshTools1.c3d = this;
ctlScene1.c3d = this;
/*ctlImageButton imbtn = new ctlImageButton();
imbtn.BackColor = System.Drawing.Color.Navy;
imbtn.CheckImage = null;
imbtn.Image = global::UV_DLP_3D_Printer.Properties.Resources.homeButt;
imbtn.Location = new System.Drawing.Point(200, 200);
imbtn.Name = "buttGlHome";
imbtn.Size = new System.Drawing.Size(48, 48);
imbtn.TabIndex = 16;
imbtn.Visible = true;
mainViewSplitContainer.Panel2.Controls.Add(imbtn);
imbtn.BringToFront();*/
//buttGlHome.GLVisible = true;
//buttGlHome.BackColor = Color.Transparent;
//buttGlHome.FixStyle();
//buttGlHome.BackColor = Color.FromArgb(60,0,0,0);
m_sliceTex = -1;
}
示例11: ISectData
public ISectData(Object3d o, Polygon p, Point3d isect, Point3d orgin, Vector3d dir)
{
intersect = new Point3d();
intersect.Set(isect);
origin = new Point3d();
direction = new Vector3d();
origin.Set(orgin);
direction.Set(dir);
obj = o;
poly = p;
}
示例12: Polygon
public Polygon()
{
m_normal = new Vector3d();
m_radius = 0.0;
m_color = Color.Gray;
m_linecolor = Color.Blue;
m_solid = true;
m_wire = true;
m_center = new Point3d();
m_minmax = null;
plane = new Plane();
}
示例13: LookAt
// create a look-at rotation matrix
public void LookAt(Vector3d dir, Vector3d up)
{
//Vector3d dir = new Vector3d(direction.x, direction.y, direction.z);
//dir.Normalize();
Vector3d vx = up.Cross(dir);
vx.Normalize();
Vector3d vy = dir.Cross(vx);
vy.Normalize();
Matrix[0, 0] = vx.x; Matrix[0, 1] = vx.y; Matrix[0, 2] = vx.z; Matrix[0, 3] = 0;
Matrix[1, 0] = vy.x; Matrix[1, 1] = vy.y; Matrix[1, 2] = vy.z; Matrix[1, 3] = 0;
Matrix[2, 0] = dir.x; Matrix[2, 1] = dir.y; Matrix[2, 2] = dir.z; Matrix[2, 3] = 0;
Matrix[3, 0] = 0; Matrix[3, 1] = 0; Matrix[3, 2] = 0; Matrix[3, 3] = 1;
}
示例14: FindIntersection
/*
public class Config
{
int xres, yres;
// double
}
* */
public static bool FindIntersection(Vector3d direction, Point3d origin, ref Point3d intersect)
{
UVDLPApp.Instance().CalcScene();
//bool intersected = false;
// Point3d bpoint, tpoint;
// Point3d lowest = new Point3d(); // the lowest point of intersection on the z axis
direction.Normalize();
direction.Scale(100.0);
Point3d endp = new Point3d();
endp.Set(origin);
endp.x += direction.x;
endp.y += direction.y;
endp.z += direction.z;
/*
intersect = new Point3d();
intersect.x = 0.0d;
intersect.y = 0.0d;
intersect.z = 0.0d;
*/
//intersect the scene with a ray
// intersected = false;
foreach (Polygon p in UVDLPApp.Instance().Scene.m_lstpolys)
{
intersect = new Point3d();
// try a less- costly sphere intersect here
if (RTUtils.IntersectSphere(origin, endp, ref intersect, p.m_center, p.m_radius))
{
// if it intersects,
if (RTUtils.IntersectPoly(p, origin, endp, ref intersect))
{
return true;
/*
// and it's the lowest one
if (intersect.z <= lowest.z)
{
//save this point
intersected = true;
lowest.Set(intersect);
}
* */
}
}
}
return false;
}
示例15: MoveForward
public void MoveForward(float dist)
{
float factor = Vector3d.length(m_eye - m_lookat) / 200.0f;
if (factor < 0.3)
factor = 0.3f;
dist = dist * factor;
Vector3d diff = (m_eye - m_lookat);
float len = Vector3d.length(diff) - dist;
if ((len <= 0) || (len >= 1000))
return;
diff.Normalize();
diff = diff * (float)dist;
m_eye = m_eye - diff;
UpdateView();
}