[vtkusers] (no subject)
Виталий Симаков
simakov.w at gmail.com
Tue Aug 15 14:18:45 EDT 2017
Guillen Antonio, thanks for the help.
But how do I get vtkChartXYZ and vtkGlyph3D to show up and spin on the same
scene? Or am I generally not doing the right thing?
2017-08-15 20:19 GMT+03:00 Guillen Antonio <tonio.guillen at gmail.com>:
> 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/0763f77b/attachment.html>
More information about the vtkusers
mailing list