[vtkusers] (no subject)
Guillen Antonio
tonio.guillen at gmail.com
Tue Aug 15 13:19:54 EDT 2017
Here a small example that i use:
Field<Vector3D> dhField = (Field) this.getDisplayedData();
DrillholeMesh dhMesh = dhField.getMesh();
double[] curvilinearAbscissae = dhMesh.getCurvilinear();
int nbFieldValues = dhField.getValues().length;
Drillhole dh = dhField.getDrillhole();
@SuppressWarnings("unchecked")
FieldDh<Vector3D> field = dhField;
if (field == null)
return false;
vtkPoints points = new vtkPoints();
points.SetDataTypeToDouble();
double[] pc = new double[3];
double[] ps = new double[3];
Vector3D[] values = field.getValues();
if (values != null) {
double sizeMaxField = aValue;
vtkArrowSource arrow = new vtkArrowSource();
arrow.SetTipRadius(0.1);
arrow.SetTipLength(1.);
arrow.SetShaftResolution(6);
arrow.SetShaftRadius(0.03);*/
vtkDoubleArray vector3DArray = new vtkDoubleArray();
vector3DArray.SetNumberOfComponents(3);
vector3DArray.SetName("Vector");
for (int i = 0; i < nbFieldValues; i++) {
Vector3D fieldValue = values[i];
if (fieldValue != null && fieldValue != field.getNoValue()) {
Point3D p =
dh.getSurvey().getPoint(curvilinearAbscissae[i]);
ps[0] = p.x;
ps[1] = p.y;
ps[2] = p.z;
points.InsertNextPoint(ps);
vector3DArray.InsertNextTuple3(fieldValue.getX(),
fieldValue.getY(), fieldValue.getZ());
}
}
vtkPolyData polyData = new vtkPolyData();
polyData.SetPoints(points);
polyData.GetPointData().SetVectors(vector3DArray);
vector3DGlyph = new vtkGlyph3D();
vector3DGlyph.SetVectorModeToUseVector();
vector3DGlyph.OrientOn();
vector3DGlyph.SetScaleFactor(sizeMaxField/2.);
vector3DGlyph.SetScaleModeToDataScalingOff();
vector3DGlyph.SetColorModeToColorByScalar();
vector3DGlyph.SetSourceConnection(arrow.GetOutputPort());
vector3DGlyph.SetInputData(polyData);
vector3DGlyph.Update();
Hope it help you.
2017-08-15 18:21 GMT+02:00 Виталий Симаков <simakov.w at gmail.com>:
> Hello.
> Recently began to study the VTK.
> Faced the following problem:
> It is necessary to draw vtkPlotLine3D and on it to represent vectors
> (Presumably vtkArrowSource).
> Someone did this? Examples did not help ... = (
> Thank you.
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170815/0106a841/attachment.html>
More information about the vtkusers
mailing list