处理OBJ提取顶点

时间:2016-12-02 17:17:06

标签: 3d processing

我如何获得,并在处理时打印OBJ的顶点?

public static void main(String[] args) {

      System.out.println("-----Formatted Past Three Days-----");
        List<Date> pastThreeDatesList = getPastThreeDays();
        for (Date date : pastThreeDatesList) {
           System.out.println("Orignal:"+date);

          long mDateMills= date.getTime() - ((5*3600 *1000)+ 45*60*1000); //you convert your date to millisecond then subtract 5h45min( in milliseconds from it)
          String  mNewDate= millsToDateFormat(mDateMills);

          System.out.println("new Date:"+mNewDate);
        }
}

public static String millsToDateFormat(long mills) {

        Date date = new Date(mills);
        DateFormat formatter = new SimpleDateFormat("HH:mm:ss");
        String dateFormatted = formatter.format(date);
        return dateFormatted; 
    }

1 个答案:

答案 0 :(得分:0)

来自the Processing forum

根据文档,getVertexCount()getVertex()函数仅适用于您通过调用vertex()函数添加的顶点,而不适用于您已加载的形状来自文件。

但有一种方法(至少有时)到达形状文件中的顶点:首先必须遍历形状文件的子项,然后从这些子项中获取顶点。

PShape shape = loadShape("x.obj");
PShape child = shape.getChild(0);
PVector vertex = child.getVertex(0);

咨询the reference以获取允许您遍历每个子PShape的函数,然后遍历每个子节点的顶点。