本文整理汇总了C#中Engine3D.Vector3d类的典型用法代码示例。如果您正苦于以下问题:C# Vector3d类的具体用法?C# Vector3d怎么用?C# Vector3d使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector3d类属于Engine3D命名空间,在下文中一共展示了Vector3d类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:RFranta,项目名称:UVDLPSlicerController,代码行数:35,代码来源:ctl3DView.cs
示例2: Dot
//dot product
public double Dot(Vector3d v)
{
double dp = ( x * v.x ) +
( y * v.y ) +
( z * v.z );
return dp;
}
开发者ID:brots,项目名称:UVDLPSlicerController,代码行数:8,代码来源:Vector3d.cs
示例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);
}
开发者ID:tojoevan,项目名称:BGC-CW,代码行数:34,代码来源:ctl3DView.cs
示例4: Dot
public double Dot(Vector3d v) //dot product
{
double dp = ( x * v.x ) +
( y * v.y ) +
( z * v.z );
return dp;
}
开发者ID:Biseny,项目名称:UVDLPSlicerController,代码行数:7,代码来源:Vector3d.cs
示例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;
}
开发者ID:Biseny,项目名称:UVDLPSlicerController,代码行数:8,代码来源:Vector3d.cs
示例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();
}
开发者ID:tojoevan,项目名称:UVDLPSlicerController,代码行数:15,代码来源:Polygon.cs
示例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;
}
开发者ID:BenjaminRaymond,项目名称:UVDLPSlicerController,代码行数:56,代码来源:RTUtils.cs
示例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;
}
开发者ID:kampos91,项目名称:UVDLPSlicerController,代码行数:10,代码来源:GLCamera.cs
示例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;
}
开发者ID:kakaka2013,项目名称:UVDLPSlicerController,代码行数:16,代码来源:Polygon.cs
示例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;
}
开发者ID:njh19,项目名称:UVDLPSlicerController,代码行数:55,代码来源:ctl3DView.cs
示例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;
}
开发者ID:RFranta,项目名称:UVDLPSlicerController,代码行数:11,代码来源:ISectData.cs
示例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();
}
开发者ID:rotteman2,项目名称:UVDLPSlicerController,代码行数:12,代码来源:Polygon.cs
示例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;
}
开发者ID:gobrien4418,项目名称:UVDLPSlicerController,代码行数:14,代码来源:Matrix3D.cs
示例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;
}
开发者ID:Elph,项目名称:UVDLPSlicerController,代码行数:55,代码来源:SupportGenerator.cs
示例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();
}
开发者ID:kakaka2013,项目名称:UVDLPSlicerController,代码行数:16,代码来源:GLCamera.cs
示例16: Initvecs
static void Initvecs()
{
vecinit = true;
u = new Vector3d();
v = new Vector3d();
n = new Vector3d();
dir = new Vector3d();
w0 = new Vector3d();
w = new Vector3d();
V = new Vector3d();
temp = new Vector3d();
IOendp = new Point3d();
IOintersect = new Point3d();
GPendp = new Point3d();
GPintersect = new Point3d();
m_isectlst = new List<ISectData>();
}
开发者ID:Biseny,项目名称:UVDLPSlicerController,代码行数:17,代码来源:RTUtils.cs
示例17: UpdateDirection
// set rotation direction based on mouse location projected to 3D space
public void UpdateDirection(float ix, float iy)
{
Vector3d mouse = new Vector3d(ix, iy, 0);
Vector3d horizon = new Vector3d(m_right.x, m_right.y, 0);
Vector3d perp = Vector3d.cross(mouse, horizon);
m_dir = Math.Sign(perp.z);
}
开发者ID:kampos91,项目名称:UVDLPSlicerController,代码行数:8,代码来源:GLCamera.cs
示例18: RotateRightFlat
public void RotateRightFlat(float deg, float dir)
{
Matrix3D rotMat = Rotate(m_zaxis, deg * dir);
m_target = rotMat.Transform(m_target);
m_right = rotMat.Transform(m_right);
m_up = rotMat.Transform(m_up);
/*m_target = m_lookat - m_eye; // The "look-at" unit vector.
m_target.Normalize();
m_right = Vector3d.cross(m_target, m_up);*/
UpdateView();
}
开发者ID:kampos91,项目名称:UVDLPSlicerController,代码行数:11,代码来源:GLCamera.cs
示例19: ISectGroundPlane
private static ISectData ISectGroundPlane(Vector3d direction, Point3d origin)
{
ISectData isect = null;
direction.Normalize();
direction.Scale(10000.0f);
GPendp.Set(origin);
GPendp.x += direction.x;
GPendp.y += direction.y;
GPendp.z += direction.z;
// intersect with the imaginary groundplane object;
if (m_gp == null)
{
CreateGroundPlane();
}
if (IntersectSphere(origin, GPendp, ref GPintersect, m_gp.m_center, m_gp.m_radius))
{
foreach (Polygon p in m_gp.m_lstpolys)
{
//GPintersect = new Point3d();
// try a less- costly sphere intersect here
if (IntersectSphere(origin, GPendp, ref GPintersect, p.m_center, p.m_radius))
{
// if it intersects,
if (RTUtils.IntersectPoly(p, origin, GPendp, ref GPintersect))
{
isect = new ISectData(m_gp, p, GPintersect, origin, direction);
}
}
}
}
return isect;
}
开发者ID:Biseny,项目名称:UVDLPSlicerController,代码行数:33,代码来源:RTUtils.cs
示例20: GenerateFromBitmap
public bool GenerateFromBitmap(string file, Vector3d f)
{
try
{
m_name = Path.GetFileName(file);
Bitmap bm = new Bitmap(file);
// add 3d points
for (int y = 0; y < bm.Height; y++)
{
for (int x = 0; x < bm.Width; x++)
{
Color clr = bm.GetPixel(x, y);
Point3d pnt = new Point3d();
pnt.x = f.x * ((float)x);
pnt.y = f.y * ((float)y);
pnt.z = f.z * ((float)clr.R);
m_lstpoints.Add(pnt);
}
}
// now generate polys
for (int y = 0; y < bm.Height ; y++)
{
for (int x = 0; x < bm.Width ; x++)
{
if (y == (bm.Height - 1)) continue;
if (x == (bm.Width - 1)) continue;
Polygon ply = new Polygon();
ply.m_points = new Point3d[3];
int idx1 = (y * bm.Width) + x;
int idx2 = (y * bm.Width) + x + 1;
int idx3 = (y * bm.Width) + x + bm.Width ;
ply.m_points[0] = (Point3d)m_lstpoints[idx1];
ply.m_points[1] = (Point3d)m_lstpoints[idx2];
ply.m_points[2] = (Point3d)m_lstpoints[idx3];
ply.CalcCenter();
ply.CalcNormal();
m_lstpolys.Add(ply);
Polygon ply2 = new Polygon();
ply2.m_points = new Point3d[3];
idx1 = (y * bm.Width) + x + 1;
idx2 = (y * bm.Width) + x + bm.Width + 1;
idx3 = (y * bm.Width) + x + bm.Width;
ply2.m_points[0] = (Point3d)m_lstpoints[idx1];
ply2.m_points[1] = (Point3d)m_lstpoints[idx2];
ply2.m_points[2] = (Point3d)m_lstpoints[idx3];
ply2.CalcCenter();
ply2.CalcNormal();
m_lstpolys.Add(ply2);
}
}
Update();
return true;
}
catch (Exception)
{
return false;
}
}
开发者ID:nick570775,项目名称:UVDLPSlicerController,代码行数:62,代码来源:Object3d.cs
注:本文中的Engine3D.Vector3d类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论