本文整理汇总了C#中Engine3D.Object3d类的典型用法代码示例。如果您正苦于以下问题:C# Object3d类的具体用法?C# Object3d怎么用?C# Object3d使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Object3d类属于Engine3D命名空间,在下文中一共展示了Object3d类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Support
private int s5i; // top of the head
#endregion Fields
#region Constructors
public Support()
{
tag = Object3d.OBJ_SUPPORT; // tag for support
m_supporting = null;
this.Name = "Support_" + supcnt.ToString();
supcnt++;
}
示例2: FillObjectInfo
public void FillObjectInfo(Object3d obj)
{
if (obj == null)
{
foreach (Control ctl in layoutPanel.Controls)
{
if (ctl.GetType() == typeof(ctlInfoItem))
((ctlInfoItem)ctl).DataText = "";
}
tName.Text = "";
return;
}
obj.FindMinMax();
tName.Text = obj.Name;
tPoints.DataText = obj.NumPoints.ToString();
tPolys.DataText = obj.NumPolys.ToString();
tMin.DataText = String.Format("{0:0.00}, {1:0.00}, {2:0.00}", obj.m_min.x, obj.m_min.y, obj.m_min.z);
tMax.DataText = String.Format("{0:0.00}, {1:0.00}, {2:0.00}", obj.m_max.x, obj.m_max.y, obj.m_max.z);
double xs, ys, zs;
xs = obj.m_max.x - obj.m_min.x;
ys = obj.m_max.y - obj.m_min.y;
zs = obj.m_max.z - obj.m_min.z;
tSize.DataText = String.Format("{0:0.00}, {1:0.00}, {2:0.00}", xs, ys, zs);
double vol = obj.Volume;
vol /= 1000.0; // convert to cm^3
tVolume.DataText = string.Format("{0:0.000} cm^3", vol);
double cost = vol * (UVDLPApp.Instance().m_buildparms.m_resinprice / 1000.0);
tCost.DataText = string.Format("{0:0.000}", cost);
}
示例3: RaiseEvent
private void RaiseEvent(eCSGEvent ev, string msg, Object3d dat)
{
if (CSGEvent != null)
{
CSGEvent(ev, msg, dat);
}
}
示例4: Clone
public virtual Object3d Clone()
{
Object3d obj = new Object3d();
try
{
obj.m_name = UVDLPApp.Instance().Engine3D.GetUniqueName( this.m_name); // need to find unique name
obj.m_fullname = this.m_fullname;
obj.tag = this.tag;
foreach (Polygon ply in m_lstpolys)
{
Polygon pl2 = new Polygon();
pl2.m_color = ply.m_color;
pl2.m_points = new Point3d[3];
obj.m_lstpolys.Add(pl2);
pl2.m_points[0] = new Point3d(ply.m_points[0]);
pl2.m_points[1] = new Point3d(ply.m_points[1]);
pl2.m_points[2] = new Point3d(ply.m_points[2]);
}
foreach (Polygon ply in obj.m_lstpolys)
{
foreach (Point3d pnt in ply.m_points)
{
obj.m_lstpoints.Add(pnt); // a fair bit of overlap, but whatever...
}
}
obj.Update();
}
catch (Exception ex)
{
DebugLogger.Instance().LogError(ex);
}
return obj;
}
示例5: AddObject
public void AddObject(Object3d obj)
{
m_objects.Add(obj);
if (ModelAddedEvent != null)
{
ModelAddedEvent(obj);
}
}
示例6: FillObjectInfo
public void FillObjectInfo(Object3d selobj)
{
List<Object3d> objects;
if (buttScene.Checked)
{
objects = UVDLPApp.Instance().Engine3D.m_objects;
}
else
{
objects = new List<Object3d>();
if (selobj != null)
objects.Add(selobj);
}
if (objects.Count == 0)
{
foreach (Control ctl in layoutPanel.Controls)
{
if (ctl.GetType() == typeof(ctlInfoItem))
((ctlInfoItem)ctl).DataText = "";
}
tName.Text = "";
return;
}
tName.Text = buttScene.Checked ? "Scene" : selobj.Name;
Point3d min = new Point3d(99999999,99999999,99999999);
Point3d max = new Point3d(-99999999,-99999999,-99999999);
int points = 0;
int polys = 0;
double vol = 0;
foreach (Object3d obj in objects)
{
if (obj.tag != Object3d.OBJ_NORMAL && obj.tag != Object3d.OBJ_SUPPORT && obj.tag != Object3d.OBJ_SUPPORT_BASE)
continue;
obj.FindMinMax();
points += obj.NumPoints;
polys += obj.NumPolys;
if (obj.m_min.x < min.x) min.x = obj.m_min.x;
if (obj.m_min.y < min.y) min.y = obj.m_min.y;
if (obj.m_min.z < min.z) min.z = obj.m_min.z;
if (obj.m_max.x > max.x) max.x = obj.m_max.x;
if (obj.m_max.y > max.y) max.y = obj.m_max.y;
if (obj.m_max.z > max.z) max.z = obj.m_max.z;
vol += obj.Volume;
}
tPoints.DataText = points.ToString();
tPolys.DataText = polys.ToString();
tMin.DataText = String.Format("{0:0.00}, {1:0.00}, {2:0.00}", min.x, min.y, min.z);
tMax.DataText = String.Format("{0:0.00}, {1:0.00}, {2:0.00}", max.x, max.y, max.z);
double xs, ys, zs;
xs = max.x - min.x;
ys = max.y - min.y;
zs = max.z - min.z;
tSize.DataText = String.Format("{0:0.00}, {1:0.00}, {2:0.00}", xs, ys, zs);
vol /= 1000.0; // convert to cm^3
tVolume.DataText = string.Format("{0:0.000} cm^3", vol);
double cost = vol * (UVDLPApp.Instance().m_buildparms.m_resinprice / 1000.0);
tCost.DataText = string.Format("{0:0.000}", cost);
}
示例7: SaveScale
public void SaveScale(Object3d obj, double x, double y, double z)
{
if ((x == 1) && (y == 1) && (z == 1))
return;
if ((x == 0) || (y == 0) || (z == 0))
return;
AddItem(eOperationType.Scale, obj, x, y, z);
}
示例8: SolidSphere
/*
class SolidSphere
{
protected:
std::vector<GLfloat> vertices;
std::vector<GLfloat> normals;
std::vector<GLfloat> texcoords;
std::vector<GLushort> indices;
public:
SolidSphere(float radius, unsigned int rings, unsigned int sectors)
{
float const R = 1./(float)(rings-1);
float const S = 1./(float)(sectors-1);
int r, s;
vertices.resize(rings * sectors * 3);
normals.resize(rings * sectors * 3);
texcoords.resize(rings * sectors * 2);
std::vector<GLfloat>::iterator v = vertices.begin();
std::vector<GLfloat>::iterator n = normals.begin();
std::vector<GLfloat>::iterator t = texcoords.begin();
for(r = 0; r < rings; r++) for(s = 0; s < sectors; s++) {
float const y = sin( -M_PI_2 + M_PI * r * R );
float const x = cos(2*M_PI * s * S) * sin( M_PI * r * R );
float const z = sin(2*M_PI * s * S) * sin( M_PI * r * R );
*t++ = s*S;
*t++ = r*R;
*v++ = x * radius;
*v++ = y * radius;
*v++ = z * radius;
*n++ = x;
*n++ = y;
*n++ = z;
}
indices.resize(rings * sectors * 4);
std::vector<GLushort>::iterator i = indices.begin();
for(r = 0; r < rings-1; r++) for(s = 0; s < sectors-1; s++) {
*i++ = r * sectors + s;
*i++ = r * sectors + (s+1);
*i++ = (r+1) * sectors + (s+1);
*i++ = (r+1) * sectors + s;
}
}
*/
public static Object3d Sphere(float radius, int rings, int sectors)
{
try
{
Object3d sp = new Object3d();
sp.Name = "Sphere";
float R = 1f/(float)(rings-1);
float S = 1f/(float)(sectors-1);
float M_PI = (float)Math.PI;// *0.0174532925f; // with deg2rad
float M_PI_2 = M_PI / 2;
for(int r = 0; r < rings; r++)
{
for(int s = 0; s < sectors; s++)
{
float y =(float) Math.Sin( - M_PI_2 + M_PI * r * R );
float x = (float)Math.Cos(2 * M_PI * s * S) * (float)Math.Sin(M_PI * r * R);
float z = (float)Math.Sin(2 * M_PI * s * S) * (float)Math.Sin(M_PI * r * R);
Point3d pnt = new Point3d(x * radius, y * radius, z * radius);
sp.m_lstpoints.Add(pnt);
}
}
//indices.resize(rings * sectors * 4);
//std::vector<GLushort>::iterator i = indices.begin();
for(int r = 0; r < rings - 1; r++)
{
for (int s = 0; s < sectors - 1; s++)
{
Polygon p1 = new Polygon();
Polygon p2 = new Polygon();
sp.m_lstpolys.Add(p1);
sp.m_lstpolys.Add(p2);
p1.m_points = new Point3d[3];
p2.m_points = new Point3d[3];
p1.m_points[2] = sp.m_lstpoints[r * sectors + s];
p1.m_points[1] = sp.m_lstpoints[r * sectors + (s + 1)];
p1.m_points[0] = sp.m_lstpoints[(r + 1) * sectors + (s + 1)];
p2.m_points[2] = sp.m_lstpoints[(r + 1) * sectors + (s + 1)];
p2.m_points[1] = sp.m_lstpoints[(r + 1) * sectors + s];
p2.m_points[0] = sp.m_lstpoints[r * sectors + s];
}
}
sp.Update();
sp.Rotate(90 * 0.0174532925f, 0, 0);
sp.Update();
return sp;
}
catch(Exception ex)
//.........这里部分代码省略.........
示例9: StartOp
public void StartOp(eCSGOp op, Object3d obj1, Object3d obj2)
{
m_op = op;
m_obj1 = obj1;
m_obj2 = obj2;
//m_cancel = false;
m_runthread = new Thread(new ThreadStart(RunThread), STACKSIZE);
m_running = true;
m_runthread.Start();
}
示例10: FindObjectNode
private TreeNode FindObjectNode(TreeNodeCollection nodes, Object3d sel)
{
TreeNode found = null;
foreach (TreeNode node in nodes) {
if (node.Tag == sel) { return node; }
found = FindObjectNode(node.Nodes, sel);
if (found!=null) { break; }
}
return found;
}
示例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: Add
/*This cuntion adds the objects points and polygons to this one*/
public void Add(Object3d obj)
{
foreach (Point3d p in obj.m_lstpoints)
{
m_lstpoints.Add(p);
}
foreach (Polygon ply in obj.m_lstpolys)
{
m_lstpolys.Add(ply);
}
Update();
}
示例13: GetNumberOfSlices
public int GetNumberOfSlices(SliceBuildConfig sp, Object3d obj)
{
try
{
obj.FindMinMax();
int numslices = (int)((obj.m_max.z - obj.m_min.z) / sp.ZThick);
return numslices;
}
catch (Exception)
{
return 0;
}
}
示例14: HighLightSelected
private void HighLightSelected(Object3d sel)
{
int idx = 0;
foreach (ListViewItem lvi in lbSupports.Items)
{
Object3d obj = (Object3d)lvi.Tag;
if (obj == sel)
{
//lbSupports.sel
lbSupports.Items[idx].Selected = true;
break;
}
idx++;
}
}
示例15: AddItem
protected void AddItem(eOperationType type, Object3d obj, double x, double y, double z)
{
if (obj == null)
return;
while (m_undopointer < m_undoItemList.Count)
{
m_undoItemList.RemoveAt(m_undopointer);
}
UndoItem item = new UndoItem();
item.opType = type;
item.obj = obj;
item.x = x;
item.y = y;
item.z = z;
item.linkedToPrev = false;
m_undoItemList.Add(item);
m_undopointer++;
UpdateButtons();
}